[Dancer-users] applying the same setting to different routes in different packages

P Kishor punk.kish at gmail.com
Tue Oct 5 14:53:59 CEST 2010


On Tue, Oct 5, 2010 at 7:46 AM, Alexis Sukrieh <sukria at sukria.net> wrote:
> Le 05/10/2010 14:32, P Kishor a écrit :
>
>> and, I get the following runtime error
>>
>> Can't call method "SUPER::opts" on an undefined value at
>> /Users/punkish/Sites/app/lib/app/app1.pm line 16.
>
>
> The way you call the opts method matters:
>
> get '/' => sub {
>    "forum opts : ".to_yaml(FooApp::Forum->opts());
> };
>
> If you don't call it that way (Class->method) $self is undef, hence your
> error.
>


Fantastic! all is well now.

This is really great, and might be worth adding to the cookbook. For
example, this will also allow me to declare other singletons such as
$dbh, for a db handle, in one place and the reuse it in other
packages.

Many thanks.

> --
> Alexis Sukrieh
>



-- 
Puneet Kishor


More information about the Dancer-users mailing list