| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Mojolicious::Plugin::Breadcrumbs; |
|
2
|
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
79620
|
use Mojo::Base 'Mojolicious::Plugin'; |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
11
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '1.001001'; # VERSION |
|
6
|
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
902
|
use utf8; |
|
|
3
|
|
|
|
|
4
|
|
|
|
3
|
|
|
|
|
7
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
my $Crumbs_Map = { |
|
10
|
|
|
|
|
|
|
'/' => 'Home', |
|
11
|
|
|
|
|
|
|
}; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub register { |
|
14
|
2
|
|
|
2
|
1
|
51
|
my ($self, $app) = @_; |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
$app->helper( |
|
17
|
|
|
|
|
|
|
breadcrumbs => sub { |
|
18
|
5
|
|
|
5
|
|
34772
|
my $c = shift; |
|
19
|
5
|
100
|
|
|
|
18
|
@_ and $Crumbs_Map = shift; |
|
20
|
|
|
|
|
|
|
|
|
21
|
5
|
100
|
|
|
|
16
|
length $c->url_for->to_string |
|
22
|
|
|
|
|
|
|
or return; # if this is the case, we're just setting the |
|
23
|
|
|
|
|
|
|
# $Crumbs_Map and not needing crumbs; |
|
24
|
|
|
|
|
|
|
|
|
25
|
4
|
|
|
|
|
1899
|
my $path = ''; |
|
26
|
4
|
|
|
|
|
7
|
my @crumbs; |
|
27
|
4
|
|
|
|
|
13
|
for my $crumb ( |
|
28
|
|
|
|
|
|
|
'', grep length, split m{/}, $c->url_for->to_string |
|
29
|
|
|
|
|
|
|
) { |
|
30
|
8
|
100
|
|
|
|
1032
|
$path .= ($path eq '/' ? '' : '/') . $crumb; |
|
31
|
8
|
|
66
|
|
|
45
|
push @crumbs, { |
|
32
|
|
|
|
|
|
|
path => $path, |
|
33
|
|
|
|
|
|
|
text => $Crumbs_Map->{ $path } |
|
34
|
|
|
|
|
|
|
// ucfirst($crumb =~ tr/-_/ /r), |
|
35
|
|
|
|
|
|
|
}; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
4
|
|
|
|
|
15
|
my $current_page = pop @crumbs; |
|
39
|
4
|
|
|
|
|
20
|
my $bread = ' |
|
40
|
|
|
|
|
|
|
join(q{▸}, |
|
41
|
|
|
|
|
|
|
(map qq{$_->{text}}, @crumbs), |
|
42
|
|
|
|
|
|
|
'', |
|
43
|
|
|
|
|
|
|
); |
|
44
|
|
|
|
|
|
|
|
|
45
|
4
|
|
|
|
|
12
|
$bread .= '' |
|
46
|
|
|
|
|
|
|
. ($current_page->{text}) . ''; |
|
47
|
|
|
|
|
|
|
|
|
48
|
4
|
|
|
|
|
11
|
return $bread; |
|
49
|
|
|
|
|
|
|
}, |
|
50
|
2
|
|
|
|
|
13
|
); |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
' |
|
54
|
|
|
|
|
|
|
Q. Why was the statement scared while the comment was not? |
|
55
|
|
|
|
|
|
|
A. Statements are executed. |
|
56
|
|
|
|
|
|
|
'; |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |