| 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
MC/DC0%0/2
ref $class || $class
ref $class
$class
Truth table33%1/3
A || B
A= ref $classB= $class
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 36 | 7 | return "$org at $self->{ 'FILE' } line $self->{ 'LINE' }.\n"; | |||||||||||||||||||
| 37 | } | ||||||||||||||||||||
| 38 | |||||||||||||||||||||
| 39 | 4 | 1; | |||||||||||||||||||
| 40 | ###EOF######################################################################## | ||||||||||||||||||||
| 41 | |||||||||||||||||||||