[Catalyst] why use a local trick to replace the "$class->NEXT::setup"

Matt S Trout dbix-class at trout.me.uk
Wed Apr 5 12:39:19 CEST 2006


luo.dongxiang wrote:
> When I was studying the source code of Catalyst, I found some 
> programming  trick:
>  
> Catalyst.pm   line  692
>  
>     # Call plugins setup
>     {
>         no warnings qw/redefine/;
>         local *setup = sub { };
>         $class->setup;
>     }

This is what allows plugins' setup methods to be called after the
setup_plugins stage without causing an infinite loop.

-- 
     Matt S Trout       Offering custom development, consultancy and support
  Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

+ Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Catalyst mailing list