mylib/MyOtherFreezer.pm

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