mylib/MyOtherFreezer.pm

filter: Statementstmt 70.0% 14 / 20 Branchbran 33.3% 4 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod 0.0% 0 / 3 totaltotal 53.8% 21 / 39 CC 7 SCAR 15.7
CC
7
Cov
56%
freeze
6.0
thaw
5.3
new
2.0
CRAP 4.8
« blib/lib/POE/Queue/Array.pm ↑ Summary blib/lib/POE/Driver/SysRW.pm »
1 # A sample external freezer for POE::Filter::Reference testing.
2  
3 package MyOtherFreezer;
4  
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 sub new {
8 0 ▶ my $type = shift;
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
9 0 return bless [ ], $type;
10 }
11  
12 sub freeze {
13 22 ▶ my $thing = shift;
Subroutine freeze: called CC=4 SCAR=17.9
Pod undocumented
14 22 ▶ $thing = shift if ref($thing) eq 'MyOtherFreezer';
Branch: 1 branch
BranchTrueFalseTotal
if ref $thing eq "MyOtherFreezer" 0 22 22
15  
16 22 ▶ if (ref($thing) eq 'SCALAR') {
Branch: 2 branches
BranchTrueFalseTotal
if (ref $thing eq 'SCALAR') { } 22 0 22
elsif (ref $thing eq 'Package') { } 0 0 0
17 22 return reverse(join "\0", ref($thing), $$thing);
18 }
19 elsif (ref($thing) eq 'Package') {
20 0 return reverse(join "\0", ref($thing), @$thing);
21 }
22 0 die "can't freeze things of type ", ref($thing);
23 }
24  
25 sub thaw {
26 22 ▶ my $thing = shift;
Subroutine thaw: called CC=4 SCAR=16.6
Pod undocumented
27 22 ▶ $thing = shift if ref($thing) eq 'MyOtherFreezer';
Branch: 1 branch
BranchTrueFalseTotal
if ref $thing eq "MyOtherFreezer" 0 22 22
28  
29 22 my ($type, @stuff) = split /\0/, reverse($thing);
30 22 ▶ if ($type eq 'SCALAR') {
Branch: 2 branches
BranchTrueFalseTotal
if ($type eq 'SCALAR') { } 22 0 22
elsif ($type eq 'Package') { } 0 0 0
31 22 my $scalar = $stuff[0];
32 22 return \$scalar;
33 }
34 elsif ($type eq 'Package') {
35 0 return bless \@stuff, $type;
36 }
37 0 die "can't thaw things of type $type";
38 }
39  
40 1 1;
« blib/lib/POE/Queue/Array.pm ↑ Summary blib/lib/POE/Driver/SysRW.pm »