/usr/share/perl5/Web/Dispatch/Node.pm is in libweb-simple-perl 0.031-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | package Web::Dispatch::Node;
use Moo;
with 'Web::Dispatch::ToApp';
for (qw(match run)) {
has "_${_}" => (is => 'ro', required => 1, init_arg => $_);
}
sub call {
my ($self, $env) = @_;
if (my ($env_delta, @match) = $self->_match->($env)) {
($env_delta, $self->_curry(@match));
} else {
()
}
}
sub _curry {
my ($self, @args) = @_;
my $run = $self->_run;
my $code = sub { $run->(@args, $_[0]) };
# if the first argument is a hashref, localize %_ to it to permit
# use of $_{name} inside the dispatch sub
ref($args[0]) eq 'HASH'
? do { my $v = $args[0]; sub { local *_ = $v; &$code } }
: $code
}
1;
|