line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
2
|
|
|
2
|
|
2180158
|
use 5.14.0; |
|
3
|
|
|
|
|
210
|
|
|
3
|
|
|
|
|
216
|
|
2
|
3
|
|
|
2
|
|
117
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
48
|
|
3
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
44
|
|
4
|
2
|
|
|
2
|
|
398
|
use Moops; |
|
2
|
|
|
|
|
30741
|
|
|
2
|
|
|
|
|
13
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# PODNAME: Pod::Weaver::Section::Badges::Utils |
7
|
|
|
|
|
|
|
|
8
|
2
|
|
|
2
|
|
109177
|
role Pod::Weaver::Section::Badges::Utils using Moose { |
|
2
|
|
|
2
|
|
44
|
|
|
2
|
|
|
2
|
|
12
|
|
|
2
|
|
|
2
|
|
2
|
|
|
2
|
|
|
2
|
|
111
|
|
|
2
|
|
|
2
|
|
474
|
|
|
2
|
|
|
2
|
|
1425
|
|
|
2
|
|
|
2
|
|
13
|
|
|
2
|
|
|
2
|
|
1512
|
|
|
2
|
|
|
2
|
|
4
|
|
|
2
|
|
|
2
|
|
12
|
|
|
2
|
|
|
2
|
|
106
|
|
|
2
|
|
|
2
|
|
3
|
|
|
2
|
|
|
2
|
|
89
|
|
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
150
|
|
|
2
|
|
|
|
|
53
|
|
|
2
|
|
|
|
|
9
|
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
17
|
|
|
2
|
|
|
|
|
6068
|
|
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
22
|
|
|
2
|
|
|
|
|
9201
|
|
|
2
|
|
|
|
|
158541
|
|
|
2
|
|
|
|
|
18
|
|
|
2
|
|
|
|
|
14841
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
23
|
|
|
2
|
|
|
|
|
754
|
|
|
2
|
|
|
|
|
5942
|
|
|
2
|
|
|
|
|
27
|
|
|
2
|
|
|
|
|
940
|
|
|
2
|
|
|
|
|
2787
|
|
|
2
|
|
|
|
|
17
|
|
|
2
|
|
|
|
|
1891
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
21
|
|
|
2
|
|
|
|
|
70699
|
|
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
69
|
|
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
2
|
|
|
2
|
|
|
|
|
53
|
|
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
71
|
|
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
241
|
|
|
2
|
|
|
|
|
5339
|
|
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
|
|
45
|
our $VERSION = '0.0201'; # VERSION |
11
|
|
|
|
|
|
|
# ABSTRACT: Some helpers |
12
|
|
|
|
|
|
|
|
13
|
2
|
|
|
2
|
|
562
|
use List::AllUtils 'first'; |
|
2
|
|
|
|
|
2865
|
|
|
2
|
|
|
|
|
122
|
|
14
|
|
|
|
|
|
|
|
15
|
2
|
50
|
|
2
|
|
15578
|
method get_params_for(Str $badgename) { |
|
2
|
50
|
|
2
|
|
4
|
|
|
2
|
50
|
|
9
|
|
237
|
|
|
2
|
50
|
|
|
|
9
|
|
|
2
|
50
|
|
|
|
3
|
|
|
2
|
|
|
|
|
343
|
|
|
2
|
|
|
|
|
7
|
|
|
9
|
|
|
|
|
23
|
|
|
9
|
|
|
|
|
23
|
|
|
9
|
|
|
|
|
29
|
|
|
9
|
|
|
|
|
27
|
|
|
9
|
|
|
|
|
11
|
|
|
9
|
|
|
|
|
60
|
|
|
9
|
|
|
|
|
21
|
|
16
|
9
|
|
|
|
|
15
|
my $params = {}; |
17
|
|
|
|
|
|
|
|
18
|
9
|
|
|
|
|
333
|
foreach my $pair ($self->badge_args_kv) { |
19
|
33
|
|
|
|
|
175
|
my($key, $value) = @$pair; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# -pluginname_* -> * |
22
|
33
|
|
|
|
|
28
|
my $key_for_plugin = $key; |
23
|
33
|
|
|
|
|
215
|
$key_for_plugin =~ s{^-${badgename}_}{}; |
24
|
|
|
|
|
|
|
|
25
|
33
|
100
|
|
|
|
782
|
$params->{ $key_for_plugin } = $value if substr($key, 0, 2 + length $badgename) eq sprintf '-%s_' => $badgename; |
26
|
|
|
|
|
|
|
} |
27
|
9
|
|
|
|
|
26
|
return %{ $params }; |
|
9
|
|
|
|
|
342
|
|
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
2
|
50
|
|
2
|
|
13369
|
method badge_to_class(Str $badge_name --> Str but assumed) { |
|
2
|
50
|
|
2
|
|
3
|
|
|
2
|
50
|
|
9
|
|
218
|
|
|
2
|
50
|
|
|
|
8
|
|
|
2
|
50
|
|
|
|
3
|
|
|
2
|
|
|
|
|
144
|
|
|
2
|
|
|
|
|
193
|
|
|
9
|
|
|
|
|
29
|
|
|
9
|
|
|
|
|
24
|
|
|
9
|
|
|
|
|
26
|
|
|
9
|
|
|
|
|
24
|
|
|
9
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
29
|
|
|
8
|
|
|
|
|
11
|
|
31
|
8
|
|
|
|
|
46
|
return sprintf 'Badge::Depot::Plugin::%s', ucfirst $badge_name; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
2
|
50
|
|
2
|
|
11307
|
method create_badges(--> ArrayRef[ ConsumerOf['Badge::Depot'] ] but assumed) { |
|
2
|
50
|
|
4
|
|
4
|
|
|
2
|
|
|
|
|
520
|
|
|
2
|
|
|
|
|
146
|
|
|
4
|
|
|
|
|
15
|
|
|
4
|
|
|
|
|
14
|
|
|
4
|
|
|
|
|
3
|
|
35
|
|
|
|
|
|
|
|
36
|
4
|
|
|
|
|
111
|
my @all_plugins = $self->plugin_searcher->plugins; |
37
|
4
|
|
|
|
|
366424
|
my @badge_objects = (); |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
BADGE: |
40
|
4
|
|
|
|
|
155
|
foreach my $badge ($self->all_badges) { |
41
|
8
|
|
|
|
|
51
|
my $wanted_plugin_class = $self->badge_to_class($badge); |
42
|
8
|
|
|
16
|
|
52
|
my $plugin_class = first { $_ eq $wanted_plugin_class } @all_plugins; |
|
16
|
|
|
|
|
26
|
|
43
|
|
|
|
|
|
|
|
44
|
8
|
50
|
|
|
|
32
|
next BADGE if !defined $plugin_class; |
45
|
8
|
|
|
|
|
31
|
my $plugin = $plugin_class->new($self->get_params_for(lc $badge)); |
46
|
|
|
|
|
|
|
|
47
|
8
|
50
|
|
|
|
6827
|
if(!$plugin->DOES('Badge::Depot')) { |
48
|
0
|
|
|
|
|
0
|
warn sprintf '! %s does not consume the Badge::Depot role', $plugin_class; |
49
|
0
|
|
|
|
|
0
|
next BADGE; |
50
|
|
|
|
|
|
|
} |
51
|
8
|
|
|
|
|
733
|
push @badge_objects => $plugin; |
52
|
|
|
|
|
|
|
} |
53
|
4
|
|
|
|
|
17
|
return \@badge_objects; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
method render_badges(Dict[ name => Str, before => Maybe[Str], after => Maybe[Str] ] $format, |
57
|
|
|
|
|
|
|
ArrayRef[ ConsumerOf['Badge::Depot'] ] $badges |
58
|
|
|
|
|
|
|
--> Str but assumed |
59
|
2
|
50
|
33
|
2
|
|
22426
|
) { |
|
2
|
50
|
33
|
2
|
|
3
|
|
|
2
|
50
|
33
|
2
|
|
230
|
|
|
2
|
50
|
33
|
8
|
|
9
|
|
|
2
|
50
|
33
|
|
|
4
|
|
|
2
|
50
|
33
|
|
|
501
|
|
|
2
|
50
|
33
|
|
|
51
|
|
|
2
|
50
|
|
|
|
4
|
|
|
2
|
50
|
|
|
|
789
|
|
|
2
|
50
|
|
|
|
115
|
|
|
8
|
50
|
|
|
|
18
|
|
|
8
|
50
|
|
|
|
20
|
|
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
16
|
|
|
8
|
|
|
|
|
10
|
|
|
8
|
|
|
|
|
8
|
|
|
8
|
|
|
|
|
27
|
|
|
8
|
|
|
|
|
98
|
|
|
8
|
|
|
|
|
51
|
|
|
8
|
|
|
|
|
39
|
|
|
8
|
|
|
|
|
21
|
|
|
8
|
|
|
|
|
23
|
|
|
8
|
|
|
|
|
14
|
|
|
8
|
|
|
|
|
8
|
|
|
8
|
|
|
|
|
7
|
|
|
8
|
|
|
|
|
25
|
|
|
8
|
|
|
|
|
11
|
|
|
8
|
|
|
|
|
6
|
|
|
8
|
|
|
|
|
12
|
|
|
16
|
|
|
|
|
259
|
|
|
16
|
|
|
|
|
45
|
|
|
16
|
|
|
|
|
40
|
|
|
16
|
|
|
|
|
287
|
|
|
8
|
|
|
|
|
217
|
|
|
8
|
|
|
|
|
9
|
|
60
|
|
|
|
|
|
|
|
61
|
8
|
100
|
|
|
|
23
|
my $part_format_name = $format->{'name'} eq 'markdown' ? 'markdown' : uc $format->{'name'}; |
62
|
|
|
|
|
|
|
|
63
|
8
|
|
|
|
|
20
|
my $pod_command_begin = sprintf '=begin %s', $part_format_name; |
64
|
8
|
|
|
|
|
11
|
my $pod_command_end = sprintf '=end %s', $part_format_name; |
65
|
8
|
|
|
|
|
13
|
my $format_method = sprintf 'to_%s', $format->{'name'}; |
66
|
|
|
|
|
|
|
|
67
|
8
|
|
|
|
|
8
|
my @badges_output = (); |
68
|
8
|
|
|
|
|
9
|
my @complete_output = (); |
69
|
|
|
|
|
|
|
|
70
|
8
|
100
|
|
8
|
|
276
|
if($self->find_format(sub { $_ eq $format->{'name'} })) { |
|
8
|
|
|
|
|
95
|
|
71
|
4
|
|
|
|
|
21
|
push @badges_output => $_->$format_method foreach (@$badges); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
} |
74
|
8
|
100
|
|
|
|
1433
|
if(@badges_output) { |
75
|
4
|
|
|
|
|
11
|
push @complete_output => '', $pod_command_begin, '', ; |
76
|
4
|
|
50
|
|
|
23
|
push @complete_output => ($format->{'before'} || '') . join (' ' => @badges_output) . ($format->{'after'} || ''); |
|
|
|
50
|
|
|
|
|
77
|
4
|
|
|
|
|
10
|
push @complete_output => '', $pod_command_end, ''; |
78
|
|
|
|
|
|
|
} |
79
|
8
|
|
|
|
|
34
|
return \@complete_output; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
__END__ |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=pod |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=encoding UTF-8 |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 NAME |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Pod::Weaver::Section::Badges::Utils - Some helpers |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 VERSION |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Version 0.0201, released 2015-03-21. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 SOURCE |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
L<https://github.com/Csson/p5-Pod-Weaver-Section-Badges> |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=head1 HOMEPAGE |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
L<https://metacpan.org/release/Pod-Weaver-Section-Badges> |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=head1 AUTHOR |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
Erik Carlsson <info@code301.com> |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Erik Carlsson <info@code301.com>. |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
116
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=cut |