NavMenu/TagGen.pm

filter: Statementstmt 100% 30 / 30 Branchbran 100% 4 / 4 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 100% 44 / 44 CC 4 SCAR 8.5
CC
4
Cov
100%
gen
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.3
« NavMenu/Predicate.pm ↑ Summary NavMenu/Tree/Node.pm »
1 package HTML::Widgets::NavMenu::TagGen;
2 2 $HTML::Widgets::NavMenu::TagGen::VERSION = '1.1000';
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use parent 'HTML::Widgets::NavMenu::Object';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶use HTML::Widgets::NavMenu::EscapeHtml qw/ escape_html /;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 __PACKAGE__->mk_acc_ref( [qw(name attributes)] );
11  
12  
13 sub _init
14 1 ▶{
Subroutine _init: called CC=1 SCAR=0.0
15 1 my ( $self, $args ) = @_;
16  
17 1 $self->name( $args->{'name'} );
18 1 $self->attributes( $args->{'attributes'} );
19  
20 1 return 0;
21 }
22  
23  
24 sub gen
25 11 ▶{
Subroutine gen: called CC=4 SCAR=13.9
Pod documented
26 11 my $self = shift;
27  
28 11 my $attr_values = shift;
29  
30 11 ▶ my $is_standalone = shift || 0;
Condition100%2/2
shift() || 0
l!l
56
MC/DC100%1/1
shift() || 0
shift()
Truth table100%2/2
A
A= shift()
Aresult
11
00
31  
32 11 my @tag_list = keys(%$attr_values);
33  
34 11 @tag_list = ( grep { defined( $attr_values->{$_} ) } @tag_list );
35  
36 11 @tag_list = ( sort { $a cmp $b } @tag_list );
37  
38 11 my $attr_spec = $self->attributes();
39  
40 return "<" . $self->name() . join(
41 "",
42 map {
43 11 " $_=\""
44 . (
45 $attr_spec->{$_}->{'escape'}
46 ? escape_html( $attr_values->{$_} )
47 19 ▶ : $attr_values->{$_}
Branch: 2 branches
BranchTrueFalseTotal
$attr_spec->{$_}{'escape'} ? : 12 7 19
$is_standalone ? : 5 6 11
48 )
49 . "\""
50 } @tag_list
51 ) . ( $is_standalone ? " /" : "" ) . ">";
52 }
53  
54 2 1;
55  
56 __END__
« NavMenu/Predicate.pm ↑ Summary NavMenu/Tree/Node.pm »