Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: RFC: Creating Dancer2 validation plugin.

by choroba (Cardinal)
on May 05, 2022 at 08:51 UTC ( [id://11143587]=note: print w/replies, xml ) Need Help??


in reply to Re: RFC: Creating Dancer2 validation plugin.
in thread RFC: Creating Dancer2 validation plugin.

>
sub _register_hooks { my $self = shift; $self->app->add_hook( Dancer2::Core::Hook->new( name => 'before_template_render', code => sub { my $tokens = shift; ...
I'd have:
sub _register_hooks { my ($self, $token) = @_; ...

But that's not equivalent! Note the anonymous sub, the second shift happens in a nested subroutine, it uses its arguments, not the _register_hooks' ones.

map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]

Replies are listed 'Best First'.
Re^3: RFC: Creating Dancer2 validation plugin.
by stevieb (Canon) on May 05, 2022 at 14:51 UTC

    You're right, I completely glossed over that. Thanks for the correction; it's a very important one!

    I still stand by the assignment rather than shift though.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11143587]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2024-03-28 09:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found