On 12/18/05, Rhesa Rozendaal <[EMAIL PROTECTED]> wrote:
>    use base qw/MyApp::Base/;
> or
>    our @ISA = qw/MyApp::Base/;
>
> is functionally equivalent. I personally prefer the former, since it reads 
> better.

Although they are very similar, there is a minor difference that can
be important in some instances.  use base takes effect at compile
time, whereas @ISA takes place at run time.  To make them equivalent,
you need to put the @ISA statement in a BEGIN {} block.

BEGIN { our @ISA = qw/MyApp::Base/ };

One place where this difference can bite you is loading a plugin (or
module) that does some work during the 'import' stage.  For example
when you use the CAP::TT plugin, it checks to see if the module is a
CGI::Application subclass, and if it is, it registers some new hooks. 
If you use @ISA but don't put it in a BEGIN block, then this will
fail, and the hooks will not be setup for you.

This is why I always use base instead of @ISA.

Cheers,

Cees

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/cgiapp@lists.erlbaum.net/
              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