Declare/Context/StringParsing.pm

filter: Statementstmt 52.0% 26 / 50 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 75.0% 12 / 16 Podpod n/a totaltotal 50.6% 38 / 75 CC 4 SCAR 10.9
CC
4
Cov
46%
__ANON__
10.2
__ANON__
4.9
__ANON__
1.6
CRAP 3.0
« Declare/DefaultSuperclassing.pm ↑ Summary Declare/Keyword/Controller.pm »
1 15 ▶use MooseX::Declare;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 15 ▶role CatalystX::Declare::Context::StringParsing {
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=1.9
4  
5 15 ▶ use Devel::Declare;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 0 ▶ method rest_of_line {
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine __ANON__: not called CC=1 SCAR=4.6
8  
9 0 $self->skipspace;
10  
11 0 my $linestr = $self->get_linestr;
12 0 my $left = substr $linestr, $self->offset;
13  
14 0 return $left;
15 15 }
16  
17 0 ▶ method strip_from_linestr (Int $chars) {
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine __ANON__: not called CC=1 SCAR=4.1
18  
19 0 my $linestr = $self->get_linestr;
20 0 substr($linestr, $self->offset, $chars) = '';
21 0 $self->set_linestr($linestr);
22 15 }
23  
24 0 ▶ method get_string {
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine __ANON__: not called CC=3 SCAR=23.2
25  
26 0 my $left = $self->rest_of_line;
27  
28 # only work on allowed types of string declarations
29 0 ▶ if ($left =~ /^"/ and my $num = Devel::Declare::toke_scan_str $self->offset) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left =~ /^"/ and my $num = Devel::Declare::toke_scan_str($self->offset)) { } 0 0 0
Condition0%0/3
$left =~ /^"/ and my $num = Devel::Declare::toke_scan_str($self->offset)
!ll&&!rl&&r
000
MC/DC0%0/2
$left =~ /^"/ and my $num = Devel::Declare::toke_scan_str($self->offset)
$left =~ /^"/ my $num = Devel::Declare::toke_scan_str($self->offset)
Truth table0%0/3
A and B
A= $left =~ /^"/B= my $num = Devel::Declare::toke_scan_str($self->offset)
ABresult
0X0
100
111
30  
31 0 my $found = Devel::Declare::get_lex_stuff;
32 0 Devel::Declare::clear_lex_stuff;
33
34 0 $self->strip_from_linestr($num);
35
36 0 return qq{"$found"};
37 }
38  
39 # check for a scalar version if nothing found
40 else {
41 0 return $self->get_scalar;
42 }
43 15 }
44  
45 0 ▶ method get_scalar {
Subroutine BEGIN: called CC=1 SCAR=1.2
Subroutine __ANON__: not called CC=2 SCAR=15.9
46
47 0 my $left = $self->rest_of_line;
48  
49 # only allow simple scalars
50 0 ▶ if ($left =~ s/^ ( \$ [a-z_] [a-z0-9_]* ) //ix) {
Branch: 1 branch
BranchTrueFalseTotal
if ($left =~ s/^ ( \$ [a-z_] [a-z0-9_]* ) //xi) { } 0 0 0
51  
52 0 my $found = $1;
53  
54 0 $self->strip_from_linestr( length $found );
55  
56 0 return qq{"$found"};
57 }
58  
59 # nothing suitable found
60 else {
61 0 return undef;
62 }
63 15 }
64 15 ▶}
Subroutine BEGIN: called CC=1 SCAR=0.0
« Declare/DefaultSuperclassing.pm ↑ Summary Declare/Keyword/Controller.pm »