[Catalyst] Reading Database At Startup

Tomas Doran bobtfish at bobtfish.net
Wed Aug 19 18:40:46 GMT 2009


On 19 Aug 2009, at 15:35, Matt Koscica wrote:

> On Wed, Aug 19, 2009 at 9:44 PM, Eden Cardim <edencardim at gmail.com>  
> wrote:

Why did you feel that quoting Eden's entire post, including signature  
was a good idea? Bottom posting and including the _ENTIRE_ message is  
even worse that top posing IMO, as it forces the reader to scroll  
past the message _they just read already_...

> Also FYI it's pretty easy to do something on startup, inside MyApp.pm:
>
> sub run {
>   my $c = shift;
>   $c->do_stuff();
>   $c->SUPER(@_);
> }

Nooo! NEVER, EVER CALL ->SUPER in a Catalyst application, it will do  
the wrong thing as Catalyst relies on multiple inheritance, and SUPER  
is likely to call the wrong thing.

You should be using ->next::method.

Also, even that is fairly fugly - I'd highly recommend using Moose's  
method modifiers, so you can write:

before run => sub {
     my $c = shift;
     # Do stuff
};

instead - no method redispatch to cock up the arguments on..

Cheers
t0m




More information about the Catalyst mailing list