On Sunday, December 5, 2004, at 07:42 PM, Mark Stosberg wrote:
What thoughts do people have on the solution that uses standard export
techniques without extra modules? This is what CGI::Application
Plugins do
now.
Yup; this "method exporting" is a workable solution that I've used in
the past, and it seems a reasonable choice if your callers are building
their own subclasses anyway.
Because you're importing those methods into custom constructed
subclasses of CGI::Application, this implementation doesn't suffer from
the worst of the namespace confusion that Stevan referred to in his
reply.
A second area of concern is that it lacks a clear re-dispatch mechanism
to allow the plugins/mixins to invoke underlying behaviors. For
example, a mixin can't simply override a built-in method to provide
benchmarking information:
package CGI::Appliction::Plugin::RunTimeLog;
@EXPORT = 'run';
sub import { goto Exporter::import }
sub run {
my $start = Benchmark->new();
(shift)->SUPER::run( @_ ); # <== XXX dies here XXX
warn "Run: " . timestr( $start->timediff( Benchmark->new() ) )
}
The SUPER call won't work because the plugin doesn't inherit from
anything. I'm not sure if the NEXT module would properly handle this
situation, although I think it might, and it would be easy to test.
-Simon
_______________________________________________
sw-design mailing list
[EMAIL PROTECTED]
http://metaperl.com/cgi-bin/mailman/listinfo/sw-design