Catalyst-Plugin-ActionPaths
view release on metacpan or search on metacpan
lib/Catalyst/Plugin/ActionPaths.pm view on Meta::CPAN
$display_path =~ s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg; # deconvert urlencoded for pretty view·
$display_path = decode_utf8 $display_path; # URI does encoding
$action->{path} = $display_path;
push @actions, $action;
}
}
}
elsif (ref $dt eq 'Catalyst::DispatchType::Chained')
{
# taken from Catalyst::DispatchType::Chained
ENDPOINT: foreach my $endpoint (
sort { $a->reverse cmp $b->reverse }
@{ $dt->_endpoints }
) {
my $args = $endpoint->list_extra_info->{Args};
my @parts = (defined($endpoint->attributes->{Args}[0]) ? (("*") x $args) : '...');
my @parents = ();
my $parent = "DUMMY";
my $extra = $dt->_list_extra_http_methods($endpoint);
my $consumes = $dt->_list_extra_consumes($endpoint);
my $scheme = $dt->_list_extra_scheme($endpoint);
my $curr = $endpoint;
my $action = $endpoint;
while ($curr) {
if (my $cap = $curr->list_extra_info->{CaptureArgs}) {
unshift(@parts, (("*") x $cap));
}
if (my $pp = $curr->attributes->{PathPart}) {
unshift(@parts, $pp->[0])
if (defined $pp->[0] && length $pp->[0]);
}
$parent = $curr->attributes->{Chained}->[0];
$curr = $dt->_actions->{$parent};
lib/Catalyst/Plugin/ActionPaths.pm view on Meta::CPAN
if (defined(my $s = $p->list_extra_info->{Scheme})) {
$scheme = uc $s;
}
unless ($p eq $parents[0]) {
$name = "-> ${name}";
}
push(@rows, [ '', $name ]);
}
if($endpoint->has_args_constraints) {
my $tc = join ',', @{$endpoint->args_constraints};
$endpoint .= " ($tc)";
} else {
$endpoint .= defined($endpoint->attributes->{Args}[0]) ? " ($args)" : " (...)";
}
push(@rows, [ '', (@rows ? "=> " : '').($extra ? "$extra " : ''). ($scheme ? "$scheme: ":'')."/${endpoint}". ($consumes ? " :$consumes":"" ) ]);
my @display_parts = map { $_ =~s/%([0-9A-Fa-f]{2})/chr(hex($1))/eg; decode_utf8 $_ } @parts;
$rows[0][0] = join('/', '', @display_parts) || '/';
$action->{path} = $rows[0][0];
push @actions, $action;
}
}
}
return \@actions;
}
( run in 0.687 second using v1.01-cache-2.11-cpan-b61123c0432 )