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.