[Catalyst] Re: Action subs executed as first loaded component, not MyApp

Michael Reece mreece at sacbee.com
Wed Apr 20 00:34:11 CEST 2005


I see this was fixed in 5.03 ..

Thanks.

On 4/18/05 4:16 PM, "Michael Reece" <mreece at sacbee.com> wrote:

> On 4/18/05 3:47 PM, "Michael Reece" <mreece at sacbee.com> wrote:
> 
>> (I also have a problem where all my actions are being called with first arg
>> of MyApp::C::CRUD -- presumably the first match for ^MyApp in the loaded
>> components? -- instead of MyApp ..)
> 
> Further debugging shows this to be the case.
> 
> If I have no components, then in Engine.pm's sub execute,
> 
>   $class = $c->comp($class) || $class;
> 
> $class will be MyApp, because $c->comp fails to find anything.
> 
> But if I have a component, such as MyApp::V::Mason, then $class becomes
> MyApp::V::Mason, and 'sub default' is called with that as first arg (aka
> $self).
> 
> ==========
> 
>> catalyst.pl MyApp
> Created "MyApp"
> ...etc
> 
>> cd MyApp/
>> vi lib/MyApp.pm
> 
> [ insert at start of sub default: warn "default called with args: @_"; ]
> 
>> ./script/server.pl
> 
> Now hit http://localhost:3000/ and you get:
> 
> default called with args: MyApp MyApp=HASH(0x874c858) at
> /home/mreece/tmp/MyApp/script/../lib/MyApp.pm line 16.
> 
>> ./script/create.pl view Mason Mason
> created "/home/mreece/tmp/MyApp/script/../lib/MyApp/V/Mason.pm"
> created "/home/mreece/tmp/MyApp/script/../t/v/mason.t"
> 
>> ./script/server.pl
> 
> Now hit http://localhost:3000/ and you get:
> default called with args: MyApp::V::Mason=HASH(0x86f1cdc)
> MyApp=HASH(0x893ddbc) at /home/mreece/tmp/MyApp/script/../lib/MyApp.pm line
> 16.
> 
> 

-- 
michael reece :: web engineer :: mreece at sacbee.com :: (916)321-1249





More information about the Catalyst mailing list