blib/lib/Template/Plugin/IO/All.pm

filter: Statementstmt 100% 22 / 22 Branchbran 83.3% 5 / 6 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 6 / 6 Podpod 100% 2 / 2 totaltotal 92.6% 38 / 41 CC 5 SCAR 7.9
CC
5
Cov
94%
new
3.0
AUTOLOAD
3.0
BEGIN
1.0
CRAP 2.2
↑ Summary
1 package Template::Plugin::IO::All;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use base qw( Template::Plugin );
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use IO::All;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 #use Data::Dumper;
8  
9 1 $Template::Plugin::IO::All::VERSION = '0.01';
10  
11 1 ▶sub load {
Subroutine load: called CC=1 SCAR=0.0
Pod documented
12 1 my ($class, $context) = @_;
13 1 bless {
14 _CONTEXT => $context,
15 }, $class;
16 }
17  
18 3 ▶sub new {
Subroutine new: called CC=3 SCAR=11.0
Pod documented
19 3 my ($self, $context, @params) = @_;
20 3 ▶ if($context and not ref $context){
Branch: 1 branch
BranchTrueFalseTotal
if ($context and not ref $context) 2 1 3
Condition66%2/3
$context and not ref $context
!ll&&!rl&&r
012
MC/DC50%1/2
$context and not ref $context
$context not ref $context
Truth table66%2/3
A and not(B)
A= $contextB= not ref $context
ABresult
0X0
100
111
21 2 $self->{_io} = io($context);
22 }
23 3 $self;
24 }
25  
26  
27 8 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: called CC=3 SCAR=11.0
28 8 my $sub = $Template::Plugin::IO::All::AUTOLOAD;
29 8 $sub =~ s/^Template::Plugin::IO::All:://o;
30 # print "[$sub]\n";
31  
32 8 ▶ if($sub =~ /^([+\-]?\d+)$/){ # Access content on a certain line
Branch: 2 branches
BranchTrueFalseTotal
if ($sub =~ /^([+\-]?\d+)$/) { } 1 7 8
elsif ($sub ne 'DESTROY') { } 7 0 7
33 1 shift->{_io}->[$1];
34 }
35 elsif($sub ne 'DESTROY'){
36 7 shift->{_io}->$sub(@_);
37 }
38 }
39  
40 1 1;
41  
42 __END__
↑ Summary