Sink/Class.pm

filter: Statementstmt 100% 17 / 17 Branchbran 100% 2 / 2 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 2 totaltotal 80.6% 25 / 31 CC 3 SCAR 4.6
CC
3
Cov
91%
new
2.1
stringify
2.0
BEGIN
1.0
CRAP 1.6
« Sink.pm ↑ Summary
1 ##############################################################################
2 #
3 # Exception::Sink::Class
4 # Copyright (c) 2006-2026 Vladi Belperchinov-Shabanski "Cade"
5 # <cade@noxrun.com> <cade@bis.bg> <cade@cpan.org>
6 # http://cade.noxrun.com/
7 #
8 # GPLv2
9 #
10 ##############################################################################
11 #
12 # sink exception class
13 #
14 ##############################################################################
15 package Exception::Sink::Class;
16 4 ▶use overload ( '""' => 'stringify', 'bool' => sub { 1 }, 'fallback' => 1 );
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine __ANON__: called CC=1 SCAR=0.0
17 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 ##############################################################################
20  
21 sub new
22 98 ▶{
Subroutine new: called CC=2 SCAR=7.2
Pod undocumented
23 98 my $class = shift;
24 98 ▶ $class = ref( $class ) || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
0980
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
25 98 my $self = { @_ };
26 98 bless $self, $class;
27 98 return $self;
28 }
29  
30 sub stringify
31 23 ▶{
Subroutine stringify: called CC=2 SCAR=6.9
Pod undocumented
32 23 my $self = shift;
33 23 my $org = $self->{ 'ORG' };
34 # like die(): text without trailing newline gets the origin appended
35 23 ▶ return $org if $org =~ /\n$/;
Branch: 1 branch
BranchTrueFalseTotal
if $org =~ /\n$/ 16 7 23
36 7 return "$org at $self->{ 'FILE' } line $self->{ 'LINE' }.\n";
37 }
38  
39 4 1;
40 ###EOF########################################################################
41  
« Sink.pm ↑ Summary