QuoteLike/Token.pm

filter: Statementstmt 86.4% 51 / 59 Branchbran 54.5% 12 / 22 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 90.4% 19 / 21 Podpod 100% 13 / 13 totaltotal 80.0% 96 / 120 CC 13 SCAR 13.0
CC
13
Cov
76%
snext_sibling
12.0
sprevious_sibling
12.0
__new
3.5
CRAP 3.7
« QuoteLike/Token/Interpolation.pm ↑ Summary QuoteLike/Token/Delimiter.pm »
1 package PPIx::QuoteLike::Token;
2  
3 7 ▶use 5.006;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 7 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 7 ▶use PPIx::QuoteLike::Constant qw{ MINIMUM_PERL @CARP_NOT };
Subroutine BEGIN: called CC=1 SCAR=0.0
10 7 ▶use PPIx::QuoteLike::Utils qw{
Subroutine BEGIN: called CC=1 SCAR=0.0
11 column_number
12 line_number
13 logical_filename
14 logical_line_number
15 statement
16 visual_column_number
17 7 };
18  
19 7 our $VERSION = '0.024';
20  
21 # Private to this package.
22 332 ▶sub __new {
Subroutine __new: called CC=3 SCAR=12.5
23 332 my ( $self, %arg ) = @_;
24 defined $arg{content}
25 332 ▶ or croak 'Content required';
Branch: 1 branch
BranchTrueFalseTotal
defined $arg{"content"} or croak("Content required") 332 0 332
26 332 ▶ return bless \%arg, ref $self || $self;
Condition33%1/3
ref $self || $self
l!l&&r!l&&!r
03320
MC/DC0%0/2
ref $self || $self
ref $self $self
Truth table33%1/3
A || B
A= ref $selfB= $self
ABresult
1X1
011
000
27 }
28  
29 558 ▶sub content {
Subroutine content: called CC=1 SCAR=0.0
Pod documented
30 558 my ( $self ) = @_;
31 558 return $self->{content};
32 }
33  
34 46 ▶sub error {
Subroutine error: called CC=1 SCAR=0.0
Pod documented
35 46 my ( $self ) = @_;
36 46 return $self->{error};
37 }
38  
39 27 ▶sub location {
Subroutine location: called CC=2 SCAR=7.1
Pod documented
40 27 my ( $self ) = @_;
41 27 ▶ return $self->{location} ? [ @{ $self->{location} } ] : undef;
Branch: 1 branch
BranchTrueFalseTotal
$self->{'location'} ? : 27 0 27
42 }
43  
44 47 ▶sub parent {
Subroutine parent: called CC=1 SCAR=0.0
Pod documented
45 47 my ( $self ) = @_;
46 47 return $self->{parent};
47 }
48  
49 46 ▶sub next_sibling {
Subroutine next_sibling: called CC=2 SCAR=6.9
Pod documented
50 46 my ( $self ) = @_;
51 $self->{next_sibling}
52 46 ▶ or return;
Branch: 1 branch
BranchTrueFalseTotal
$self->{"next_sibling"} or return 21 25 46
53 21 return $self->{next_sibling};
54 }
55  
56 80 ▶sub perl_version_introduced {
Subroutine perl_version_introduced: called CC=3 SCAR=11.0
Pod documented
57 80 my ( $self ) = @_;
58 # TODO use '//' when we can require Perl 5.10.
59 defined $self->{perl_version_introduced}
60 80 ▶ and return $self->{perl_version_introduced};
Branch: 1 branch
BranchTrueFalseTotal
defined $self->{"perl_version_introduced"} and return $self->{"perl_version_introduced"} 15 65 80
61 65 my $vers = $self->__perl_version_introduced();
62 65 ▶ defined $vers
Branch: 1 branch
BranchTrueFalseTotal
defined $vers or $vers = "5.000" 10 55 65
63 or $vers = MINIMUM_PERL;
64 65 return ( $self->{perl_version_introduced} = $vers );
65 }
66  
67 44 ▶sub __perl_version_introduced {
Subroutine __perl_version_introduced: called CC=1 SCAR=0.0
68 44 return;
69 }
70  
71 62 ▶sub perl_version_removed {
Subroutine perl_version_removed: called CC=1 SCAR=0.0
Pod documented
72 62 return undef; ## no critic (ProhibitExplicitReturnUndef)
73 }
74  
75 46 ▶sub previous_sibling {
Subroutine previous_sibling: called CC=2 SCAR=6.9
Pod documented
76 46 my ( $self ) = @_;
77 $self->{previous_sibling}
78 46 ▶ or return;
Branch: 1 branch
BranchTrueFalseTotal
$self->{"previous_sibling"} or return 20 26 46
79 20 return $self->{previous_sibling};
80 }
81  
82 21 ▶sub significant {
Subroutine significant: called CC=1 SCAR=0.0
Pod documented
83 21 return 1;
84 }
85  
86 0 ▶sub snext_sibling {
Subroutine snext_sibling: not called CC=3 SCAR=24.8
Pod documented
87 0 my ( $sib ) = @_;
88 0 ▶ while ( $sib = $sib->next_sibling() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sib = $sib->next_sibling) 0 0 0
89 0 ▶ $sib->significant()
Branch: 1 branch
BranchTrueFalseTotal
$sib->significant and return $sib 0 0 0
90 and return $sib;
91 }
92 0 return;
93 }
94  
95 0 ▶sub sprevious_sibling {
Subroutine sprevious_sibling: not called CC=3 SCAR=24.8
Pod documented
96 0 my ( $sib ) = @_;
97 0 ▶ while ( $sib = $sib->previous_sibling() ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sib = $sib->previous_sibling) 0 0 0
98 0 ▶ $sib->significant()
Branch: 1 branch
BranchTrueFalseTotal
$sib->significant and return $sib 0 0 0
99 and return $sib;
100 }
101 0 return;
102 }
103  
104 1 ▶sub top {
Subroutine top: called CC=2 SCAR=6.9
Pod documented
105 1 my ( $self ) = @_;
106 1 my $kid = $self;
107 1 ▶ while ( defined ( my $parent = $kid->parent() ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $parent = $kid->parent)) 1 1 2
108 1 $kid = $parent;
109 }
110 1 return $kid;
111 }
112  
113 45 ▶sub variables {
Subroutine variables: called CC=1 SCAR=0.0
Pod documented
114 45 return;
115 }
116  
117 7 1;
118  
119 __END__
« QuoteLike/Token/Interpolation.pm ↑ Summary QuoteLike/Token/Delimiter.pm »