[dancer-users] Global keywords still in Dancer 2?

Henk van Oers hvo.pm at xs4all.nl
Sun Dec 16 01:01:20 GMT 2012


On Sat, 15 Dec 2012, gvim wrote:

> Just realised I may be missing the obvious - if Dancer was object oriented 
> you wouldn't have:
>
> get '/routename' => sub {  };
>
> ... but rather something like:
>
> my $d = Dancer->new;

This is an object constructor
but in Perl you don't have to call it 'new'.

> $d->get('/routname', $subref);

The $d object needs some values for the 'get' attribute.

In one line:

my $d = Dancer->new->get('/routname', $subref);

Mmm, I do not need $d and let's write 'Dancer->new->get' as get:

get '/routename' => sub {  };


Very object oriented IMHO.

-- 
Henk


More information about the dancer-users mailing list