On Mon, Jun 18, 2007 at 11:50:06AM -0700, Quinn Weaver wrote:
> Hi, all,
> 
> During some debugging, I noticed that MyApp::setup is called twice.
> This looks like an intentional feature.  My question is, why?
> 
> From MyApp.pm:
> 
>    my $ret = $self->SUPER::setup( @_ );
> 
> From Catalyst.pm:  
> 
>     # Call plugins setup
>     {
>         no warnings qw/redefine/;
>         local *setup = sub { };
>         $class->setup;
>     }
> 
> Yep, the latter code locally redefines the parent class setup to a
> no-op in order to prevent an infinite loop, then calls the child class
> (MyApp) setup.  The effect is that every line in MyApp::setup is
> executed twice.

No it isn't. The redefine means it -isn't- called a second time.

But all the plugins' setup() methods (which weren't in @ISA when setup was
first called) -are- called.

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/             http://www.shadowcatsystems.co.uk/ 

_______________________________________________
List: Catalyst@lists.rawmode.org
Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@lists.rawmode.org/
Dev site: http://dev.catalyst.perl.org/

Reply via email to