blib/lib/Class/Void.pm

filter: Statementstmt 100% 25 / 25 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 91.6% 11 / 12 Podpod 0.0% 0 / 2 totaltotal 92.6% 38 / 41 CC 2 SCAR 1.4
CC
2
Cov
100%
new
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
↑ Summary
1 package Class::Void;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use vars qw($VERSION $Nothin $new);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 $VERSION = 0.05;
6  
7 9 ▶use overload q("") => sub { "" }, # stringify to the empty string (returning undef is poised to create warnings)
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
8 1 ▶ "nomethod" => sub { shift->new }; # call new for all other overloadable operators
Subroutine __ANON__: called CC=1 SCAR=0.0
9  
10 1 ▶$new = sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
11 # private sub so my name space doesnt get polluted which anything that could stop the AUTOLOAD sub from executing
12 1 my $scalar; # allocate an empty scalar
13 1 bless \$scalar, shift; # bless it into the calling package, and return it
14 1 };
15  
16 27 ▶sub new {
Subroutine new: called CC=2 SCAR=6.9
Pod undocumented
17 27 ▶ $Nothin = $new->(shift) unless defined $Nothin; # define $Nothin once
Branch: 1 branch
BranchTrueFalseTotal
unless defined $Class::Void::Nothin 1 26 27
18 27 return $Nothin;
19 }
20  
21 1 ▶sub can {
Subroutine can: called CC=1 SCAR=0.0
Pod undocumented
22 1 my $class = shift;
23 1 ▶ sub { $class->new }
Subroutine __ANON__: called CC=1 SCAR=0.0
24 1 }
25  
26 7 ▶sub AUTOLOAD { shift->new };
Subroutine AUTOLOAD: called CC=1 SCAR=0.0
27  
28 0 ▶sub DESTROY {}; # autoloading DESTROY would lead to an infinite loop because it'd create
Subroutine DESTROY: not called CC=1 SCAR=0.0
29 # a new object which in turn calls destroy immediately and so on
30
31 1 q<I ain't seen nothin>
32  
33 __END__
↑ Summary