Simple/PullParserStartToken.pm

filter: Statementstmt 74.0% 20 / 27 Branchbran 33.3% 2 / 6 Conditioncond 22.2% 2 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 80.0% 8 / 10 Podpod 85.7% 6 / 7 totaltotal 59.3% 38 / 64 CC 8 SCAR 17.0
CC
8
Cov
57%
attr
13.1
attr_hash
6.0
new
2.3
CRAP 5.5
« Simple/Checker.pm ↑ Summary Simple/XMLOutStream.pm »
1 package Pod::Simple::PullParserStartToken;
2 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 10 ▶use Pod::Simple::PullParserToken ();
Subroutine BEGIN: called CC=1 SCAR=0.0
5 10 our @ISA = ('Pod::Simple::PullParserToken');
6 10 our $VERSION = '3.48';
7  
8 349 ▶sub new { # Class->new(tagname, optional_attrhash);
Subroutine new: called CC=2 SCAR=8.1
Pod undocumented
9 349 my $class = shift;
10 349 ▶ return bless ['start', @_], ref($class) || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
03490
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
11 }
12  
13 # Purely accessors:
14  
15 474 ▶sub tagname { (@_ == 2) ? ($_[0][1] = $_[1]) : $_[0][1] }
Subroutine tagname: called CC=2 SCAR=7.6
Pod documented
Branch: 1 branch
BranchTrueFalseTotal
@_ == 2 ? : 0 474 474
16 3 ▶sub tag { shift->tagname(@_) }
Subroutine tag: called CC=1 SCAR=0.0
Pod documented
17  
18 2 ▶sub is_tagname { $_[0][1] eq $_[1] }
Subroutine is_tagname: called CC=1 SCAR=0.0
Pod documented
19 0 ▶sub is_tag { shift->is_tagname(@_) }
Subroutine is_tag: not called CC=1 SCAR=6.9
Pod documented
20  
21  
22 0 ▶sub attr_hash { $_[0][2] ||= {} }
Subroutine attr_hash: not called CC=2 SCAR=17.9
Pod documented
Condition0%0/2
$_[0][2] ||= {}
l!l
00
MC/DC0%0/1
$_[0][2] ||= {}
$_[0][2]
Truth table0%0/2
A
A= $_[0][2]
Aresult
11
00
23  
24 82 ▶sub attr {
Subroutine attr: called CC=5 SCAR=25.7
Pod documented
25 82 ▶ if(@_ == 2) { # Reading: $token->attr('attrname')
Branch: 2 branches
BranchTrueFalseTotal
if (@_ == 2) { } 82 0 82
elsif (@_ > 2) { } 0 0 0
26 82 ▶ ${$_[0][2] || return undef}{ $_[1] };
Condition50%1/2
$_[0][2] || (return undef)
l!l
820
MC/DC0%0/1
$_[0][2] || (return undef)
$_[0][2]
Truth table50%1/2
A
A= $_[0][2]
Aresult
11
00
27 } elsif(@_ > 2) { # Writing: $token->attr('attrname', 'newval')
28 0 ▶ ${$_[0][2] ||= {}}{ $_[1] } = $_[2];
Condition0%0/2
$_[0][2] ||= {}
l!l
00
MC/DC0%0/1
$_[0][2] ||= {}
$_[0][2]
Truth table0%0/2
A
A= $_[0][2]
Aresult
11
00
29 } else {
30 0 require Carp;
31 0 Carp::croak(
32 'usage: $object->attr("val") or $object->attr("key", "newval")');
33 0 return undef;
34 }
35 }
36  
37 10 1;
38  
39  
40 __END__
« Simple/Checker.pm ↑ Summary Simple/XMLOutStream.pm »