David Cantrell <[email protected]> wrote:

>On Wed, Feb 15, 2012 at 06:35:50PM +0000, David Precious wrote:
>> David Cantrell <[email protected]> wrote:
>> > get '/billing' => sub :CapoFamiglia :Accountants { ... };
>> > get '/killing' => sub :CapoFamiglia :Hitmen      { ... };
>> > 
>> > So, my question is ... how can I get at those subroutine references
>> > from inside my 'before' hook so that I can
>> > attributes::get($route_handler) ?
>> Probably the easiest, and most sane, way, would be for the before
>hook
>> to get passed the route handler as a parameter.
>
>While we're at it, could we also have the route - eg /killing/:client -
>as well as the handler?

As the before handler will receive a Dancer::Route object it should be trivial 
to find out the path defined for that route - see the POD for that module. 


>That would also get rid of the little niggle I would have about
>specifically passing extra data to 'before' hooks - unless you meant to
>also pass the data to other hooks too.

No, only before hooks would get the route object. What (if anything) gets 
passed to each hook is documented in the docs for the 'hook' keyword. 



>> I'll check none of the other core devs object to this (I can't think
>> why they would), then Make It So. 
>
>Thanks!
>
>-- 
>David Cantrell | Official London Perl Mongers Bad Influence
>
>What profiteth a man, if he win a flame war, yet lose his cool?
>_______________________________________________
>Dancer-users mailing list
>[email protected]
>http://www.backup-manager.org/cgi-bin/listinfo/dancer-users

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
_______________________________________________
Dancer-users mailing list
[email protected]
http://www.backup-manager.org/cgi-bin/listinfo/dancer-users

Reply via email to