mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-28 13:21:28 +00:00
Changed the default handling of the generic output module. Now, if there's no generic dispatcher for an output command, it'll effectively synthesise one on the fly, using the method name as the string name and the arguments as an array of values for a 'data' variable. This means that applications can skip out on implementing a generic dispatcher now. Anyone using strings with dot separators (i.e. anyone writing libraries) still need to have generic output dispatcher methods though, to map the method call to a string name.
This commit is contained in:
parent
927a78dfd7
commit
724d714a02
@ -144,7 +144,13 @@ sub methodMissing {
|
||||
my $self = shift;
|
||||
my($method, @arguments) = @_;
|
||||
if (not $self->app->dispatchMethod('dispatcher.output.'.$self->actualProtocol, 'output', $method, $self, @arguments)) {
|
||||
$self->SUPER::methodMissing(@_); # this does the same, but for 'dispatcher.output.generic' handlers, since that is our $self->protocol
|
||||
# ok, no generic output dispatcher for the actual protocol, let's try the generic protocol
|
||||
if (not $self->app->dispatchMethod('dispatcher.output.'.$self->protocol, 'output', $method, $self, @arguments)) {
|
||||
# nope, so let's do our own.
|
||||
# this assumes the string will be the same as the output
|
||||
# method and that the arguments will be all in 'data'.
|
||||
$self->output($method, { 'data' => \@arguments });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user