Mojolicious-Plugin-Breadcrumbs
view release on metacpan or search on metacpan
lib/Mojolicious/Plugin/Breadcrumbs.pm view on Meta::CPAN
my $c = shift;
@_ and $Crumbs_Map = shift;
length $c->url_for->to_string
or return; # if this is the case, we're just setting the
# $Crumbs_Map and not needing crumbs;
my $path = '';
my @crumbs;
for my $crumb (
'', grep length, split m{/}, $c->url_for->to_string
) {
$path .= ($path eq '/' ? '' : '/') . $crumb;
push @crumbs, {
path => $path,
text => $Crumbs_Map->{ $path }
// do{
( my $x = $crumb ) =~ tr/-_/ /;
ucfirst $x;
},
};
( run in 1.946 second using v1.01-cache-2.11-cpan-71847e10f99 )