blib/lib/Tags/Element.pm

filter: Statementstmt 100% 26 / 26 Branchbran 100% 8 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 1 / 1 totaltotal 100% 40 / 40 CC 7 SCAR 15.7
CC
7
Cov
100%
element
7.0
BEGIN
1.0
BEGIN
1.0
CRAP 4.8
↑ Summary
1 package Tags::Element;
2  
3 3 ▶use base qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 # Constants.
10 3 Readonly::Array our @EXPORT_OK => qw(element);
11  
12 # Version.
13 3 our $VERSION = 0.04;
14  
15 # Common element.
16 8 ▶sub element {
Subroutine element: called CC=7 SCAR=19.5
Pod documented
17 8 my ($element, @data) = @_;
18  
19 8 my @attr;
20 my @content;
21 8 foreach my $ref (@data) {
22 10 ▶ if (ref $ref eq 'HASH') {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $ref eq 'HASH') { } 4 6 10
elsif (ref $ref eq 'ARRAY') { } 3 3 6
23 4 foreach my $key (sort keys %{$ref}) {
24 3 push @attr, ['a', $key, $ref->{$key}];
25 }
26 } elsif (ref $ref eq 'ARRAY') {
27 3 push @content, @{$ref};
28 } else {
29 3 push @content, ['d', $ref];
30 }
31 }
32  
33 return (
34 8 ▶ ['b', $element],
Branch: 2 branches
BranchTrueFalseTotal
@attr ? : 3 5 8
@content ? : 5 3 8
35 @attr ? @attr : (),
36 @content ? @content : (),
37 ['e', $element],
38 );
39 }
40  
41 3 1;
42  
43 __END__
↑ Summary