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

David Precious davidp at preshweb.co.uk
Tue Dec 18 12:50:35 GMT 2012


On Sat, 15 Dec 2012 23:12:18 +0000
gvim <gvimrc at gmail.com> wrote:

> On 15/12/2012 22:28, David Precious wrote:
> > On Sat, 15 Dec 2012 21:29:09 +0000
> > gvim <gvimrc at gmail.com> wrote:
> >
> >> I like a lot about Dancer 1 but I don't like the PHP-ish style of
> >> having all the helper kewords/functions in the global namespace.
> >
> > That's Dancer's DSL, and is a fairly core part of what Dancer is.
> > Some people dislike DSLs, but a lot of people do like and enjoy it,
> > and it certainly makes for clear and expressive code, no?

 
> 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;
> $d->get('/routname', $subref);

Dancer is, if you like, DSL-orientated, so, yes, you get DSL keywords
by default - that's how it is designed.  Dancer2 is all OO under the
hood, though.

If you don't want the DSL keywords, you can disable importing them -
hell, you can even replace the core DSL with your own:

http://advent.perldancer.org/2012/17

Does that help?



-- 
David Precious ("bigpresh") <davidp at preshweb.co.uk>
http://www.preshweb.co.uk/     www.preshweb.co.uk/twitter
www.preshweb.co.uk/linkedin    www.preshweb.co.uk/facebook
www.preshweb.co.uk/cpan        www.preshweb.co.uk/github




More information about the dancer-users mailing list