Snippet/TabStop/WithDefault.pm

filter: Statementstmt 100% 24 / 24 Branchbran 100% 4 / 4 Conditioncond 100% 2 / 2 MC/DCmcdc 100% 1 / 1 Subroutinesub 100% 8 / 8 Podpod 100% 2 / 2 totaltotal 100% 41 / 41 CC 4 SCAR 5.5
CC
4
Cov
100%
parse
3.0
replacement
2.0
BEGIN
1.0
CRAP 1.7
« Snippet/TabStop/Basic.pm ↑ Summary
1 package Text::Snippet::TabStop::WithDefault;
2 11 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 11 $Text::Snippet::TabStop::WithDefault::VERSION = '0.04';
4 }
5  
6 # ABSTRACT: Tab stop that specifies a default value for the user
7  
8 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 11 ▶use base qw(Text::Snippet::TabStop);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 11 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 11 ▶use Class::XSAccessor getters => { default => 'default' };
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14  
15 11 ▶sub replacement {
Subroutine replacement: called CC=2 SCAR=6.9
Pod documented
16 11 my $self = shift;
17 11 ▶ return $self->has_replacement ? $self->SUPER::replacement : $self->default;
Branch: 1 branch
BranchTrueFalseTotal
$self->has_replacement ? : 3 8 11
18 }
19  
20 16 ▶sub parse {
Subroutine parse: called CC=3 SCAR=11.0
Pod documented
21 16 my $class = shift;
22 16 my $src = shift;
23 16 ▶ if($src =~ m/\$\{(\d+):(.*)\}/){
Branch: 1 branch
BranchTrueFalseTotal
if ($src =~ /\$\{(\d+):(.*)\}/) 10 6 16
24 10 ▶ return $class->_new( index => $1, src => $src, default => $2 || '' );
Condition100%2/2
$2 || ''
l!l
91
MC/DC100%1/1
$2 || ''
$2
Truth table100%2/2
A
A= $2
Aresult
11
00
25 }
26 6 return;
27 }
28  
29 11 1;
30  
31 __END__
« Snippet/TabStop/Basic.pm ↑ Summary