Parser/Util/Context.pm

filter: Statementstmt 100% 28 / 28 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 3 totaltotal 90.2% 37 / 41 CC 2 SCAR 2.0
CC
2
Cov
97%
child_class
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« Parser/File/Navi.pm ↑ Summary Parser/File/Parser/OPF.pm »
1 package EPUB::Parser::Util::Context;
2 14 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 14 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 14 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 14 ▶use Smart::Args;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 14 ▶use Exporter qw/import/;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 14 our @EXPORT_OK = qw/ child_class context_name parser /;
9  
10 17 ▶sub child_class {
Subroutine child_class: called CC=2 SCAR=7.0
Pod undocumented
11 17 args(
12 my $class => 'ClassName',
13 my $context_name => 'Str',
14 );
15  
16 17 my $child_class = sprintf( "%s::%s", $class, ucfirst($context_name) );
17  
18 17 local $@;
19 17 eval "require $child_class";
20 17 ▶ die $@ if $@;
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 17 17
21  
22 17 return $child_class;
23 }
24  
25 44 ▶sub context_name { shift->{context_name} }
Subroutine context_name: called CC=1 SCAR=0.0
Pod undocumented
26  
27 44 ▶sub parser {
Subroutine parser: called CC=1 SCAR=0.0
Pod undocumented
28 44 my $self = shift;
29 44 my $context = 'in_' . $self->context_name;
30 44 $self->{parser}->$context;
31 44 $self->{parser};
32 }
33  
34  
35 14 1;
36  
« Parser/File/Navi.pm ↑ Summary Parser/File/Parser/OPF.pm »