Dave Cross: Still Munging Data With Perl: Online event - Mar 17 Learn more
12345678910111213 package Example::ActionRole::Authenticated;use Moose::Role;requires 'match', 'match_captures';around ['match','match_captures'] => sub { my ($orig, $self, $ctx, @args) = @_; return $self->$orig($ctx, @args) if $ctx->can('user') && $ctx->user->authenticated; return 0;};1;
package
Example::ActionRole::Authenticated;
use
Moose::Role;
requires
'match'
,
'match_captures'
;
around
[
] =>
sub
{
my
(
$orig
$self
$ctx
@args
) =
@_
return
->
)
if
->can(
'user'
) &&
->user->authenticated;
0;
};
1;