Snippet/TabStop/Parser.pm

filter: Statementstmt 96.1% 25 / 26 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 94.7% 36 / 38 CC 5 SCAR 7.4
CC
5
Cov
93%
BEGIN
3.0
parse
3.0
BEGIN
1.0
CRAP 2.1
« Snippet/TabStop.pm ↑ Summary Snippet/TabStop/WithTransformer.pm »
1 package Text::Snippet::TabStop::Parser;
2 10 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 10 $Text::Snippet::TabStop::Parser::VERSION = '0.04';
4 }
5  
6 # ABSTRACT: Parses an individual tab stop
7  
8 10 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 10 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 10 ▶use List::Util qw(first);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 10 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 10 my @types;
14 10 ▶BEGIN {
Subroutine BEGIN: called CC=3 SCAR=11.1
15 10 @types = map { "Text::Snippet::TabStop::$_" } qw( Basic WithDefault WithTransformer );
16 10 for(@types){
17 30 eval "require $_";
18 30 ▶ croak $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 30 30
19 }
20 }
21  
22  
23 70 ▶sub parse {
Subroutine parse: called CC=3 SCAR=11.0
Pod documented
24 70 my $class = shift;
25 70 my $src = shift;
26 70 foreach my $t(@types){
27 92 my $p = $t->parse($src);
28 92 ▶ return $p if defined $p;
Branch: 1 branch
BranchTrueFalseTotal
if defined $p 70 22 92
29 }
30 0 croak "unable to find parser for tab stop source: [$src]";
31 }
32  
33 10 1;
34  
35 __END__
« Snippet/TabStop.pm ↑ Summary Snippet/TabStop/WithTransformer.pm »