Bill Catlan wrote:
Hi Cees,

Thank you for the thorough response. I thought of the
problem you mention, but not so much from the "rug
being pulled out from under you in mod_perl" angle. Still, the issue is the same - namespace collision. I'm not sure I can propose the best solution without
some more thought. However, you can still have
namespace collisions between plugins brought into an
app module, which is not desirable and which I propose
should be solved now. Thus, if we need to solve the
namespace problem, we should solve it and use the
approach that brings the plugin into C::A, since it is
a C::A plugin.

Why do we need to put things into C::A's namespace? I thought they just showed that this is a bad idea. Even if we implement 'register-unregister' system, you're every application running cgiapp on a mod_perl server could be ruined if *one* programmer forgot to unregister his plugin. And not just til he fixes it, but until the server get's rebooted. I think that's a very bad situation to even allow to happen.


I think the only save way to import these methods into any namespace is to put them into the app's namespace wich is using it. Anything else will cause problems.

You're right, this does leave a problem with one plugin's methods overriding anothers. I can't think of a good way to solve this unless we ask that each method be descriptive. Like Cees's 'tt_process()' method (for CGI::Application::Template) instead of just 'process'.

Or we could try to introduce an intermediary namespace chosen by the user to access the methods. Maybe something like this...

    package MyApp;
    use base 'CGI::Application';
    use CGI::Application::Plugin::Foo qw(name => foo);

    [snip]

    #call foo_stuff() that comes from C::A::P::Foo plugin
    $self->plugins{foo}->foo_stuff;


I don't particularly like that idea since it makes it more complicated, but at least it would solve namespace collisions cause the user using the plugin could name it whatever he wants.



-- Michael Peters Developer Plus Three, LP


--------------------------------------------------------------------- Web Archive: http://www.mail-archive.com/[EMAIL PROTECTED]/ http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2 To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to