From 724d714a024663f12be67d6ff1159a921db42b96 Mon Sep 17 00:00:00 2001 From: "ian%hixie.ch" Date: Sat, 6 Jul 2002 16:05:48 +0000 Subject: [PATCH] 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. --- webtools/PLIF/PLIF/Output/Generic.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/webtools/PLIF/PLIF/Output/Generic.pm b/webtools/PLIF/PLIF/Output/Generic.pm index d982006c6a15..98b6d43d371e 100644 --- a/webtools/PLIF/PLIF/Output/Generic.pm +++ b/webtools/PLIF/PLIF/Output/Generic.pm @@ -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 }); + } } }