Simple/TiedOutFH.pm

filter: Statementstmt 76.3% 29 / 38 Branchbran 62.5% 5 / 8 Conditioncond 44.4% 4 / 9 MC/DCmcdc 16.6% 1 / 6 Subroutinesub 63.6% 7 / 11 Podpod 0.0% 0 / 1 totaltotal 63.0% 46 / 73 CC 9 SCAR 12.4
CC
9
Cov
69%
handle_on
6.6
TIEHANDLE
3.5
PRINT
2.0
CRAP 3.5
« Simple/DumpAsText.pm ↑ Summary Simple/DumpAsXML.pm »
1 package Pod::Simple::TiedOutFH;
2 71 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 71 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 71 ▶use Symbol ('gensym');
Subroutine BEGIN: called CC=1 SCAR=0.0
5 71 ▶use Carp ();
Subroutine BEGIN: called CC=1 SCAR=0.0
6 71 our $VERSION = '3.48';
7  
8 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9  
10 893 ▶sub handle_on { # some horrible frightening things are encapsulated in here
Subroutine handle_on: called CC=6 SCAR=18.8
Pod undocumented
11 893 my $class = shift;
12 893 ▶ $class = ref($class) || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
08930
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
13  
14 893 ▶ Carp::croak "Usage: ${class}->handle_on(\$somescalar)" unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 893 893
15  
16 893 ▶ my $x = (defined($_[0]) and ref($_[0]))
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0] && ref $_[0] ? : 890 3 893
Condition66%2/3
defined $_[0] and ref $_[0]
!ll&&!rl&&r
03890
MC/DC50%1/2
defined $_[0] and ref $_[0]
defined $_[0] ref $_[0]
Truth table66%2/3
A and B
A= defined $_[0]B= ref $_[0]
ABresult
0X0
100
111
17 ? $_[0]
18 : ( \( $_[0] ) )[0]
19 ;
20 893 ▶ $$x = '' unless defined $$x;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $$x 0 893 893
21  
22 #Pod::Simple::DEBUG and print STDERR "New $class handle on $x = \"$$x\"\n";
23  
24 893 my $new = gensym();
25 893 tie *$new, $class, $x;
26 893 return $new;
27 }
28  
29 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
30  
31 893 ▶sub TIEHANDLE { # Ties to just a scalar ref
Subroutine TIEHANDLE: called CC=3 SCAR=12.5
32 893 my($class, $scalar_ref) = @_;
33 893 ▶ $$scalar_ref = '' unless defined $$scalar_ref;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $$scalar_ref 0 893 893
34 893 ▶ return bless \$scalar_ref, ref($class) || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
08930
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
35 }
36  
37 18188 ▶sub PRINT {
Subroutine PRINT: called CC=2 SCAR=6.9
38 18188 my $it = shift;
39 18188 foreach my $x (@_) { $$$it .= $x }
40  
41 #Pod::Simple::DEBUG > 10 and print STDERR " appended to $$it = \"$$$it\"\n";
42  
43 18188 return 1;
44 }
45  
46 0 ▶sub FETCH {
Subroutine FETCH: not called CC=1 SCAR=6.9
47 0 return ${$_[0]};
48 }
49  
50 0 ▶sub PRINTF {
Subroutine PRINTF: not called CC=1 SCAR=6.9
51 0 my $it = shift;
52 0 my $format = shift;
53 0 $$$it .= sprintf $format, @_;
54 0 return 1;
55 }
56  
57 0 ▶sub FILENO { ${ $_[0] } + 100 } # just to produce SOME number
Subroutine FILENO: not called CC=1 SCAR=6.9
58  
59 0 ▶sub CLOSE { 1 }
Subroutine CLOSE: not called CC=1 SCAR=6.9
60  
61 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
62 71 1;
63 __END__
« Simple/DumpAsText.pm ↑ Summary Simple/DumpAsXML.pm »