| 1 | package Kelp::Exception; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use Kelp::Base; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 4 | ▶ | use Carp; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 0 | ▶ | attr -code => sub { croak 'code is required' }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 4 | attr body => undef; | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | sub new | ||||||||||||||||||||||||||||
| 12 | 15 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 13 | 15 | my ($class, $code, %params) = @_; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 15 | ▶ | croak 'Kelp::Exception can only accept 4XX or 5XX codes' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $code and $code =~ /^[45]\d\d$/
MC/DC50%1/2
defined $code and $code =~ /^[45]\d\d$/
defined $code
$code =~ /^[45]\d\d$/
Truth table66%2/3
A and B
A= defined $codeB= $code =~ /^[45]\d\d$/
| |||||||||||||||||||||||||||||
| 16 | unless defined $code && $code =~ /^[45]\d\d$/; | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 13 | $params{code} = $code; | |||||||||||||||||||||||||||
| 19 | 13 | return $class->SUPER::new(%params); | |||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | sub throw | ||||||||||||||||||||||||||||
| 23 | 15 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
throw: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 24 | 15 | my $self = shift; | |||||||||||||||||||||||||||
| 25 | 15 | ▶ | if (!ref $self) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 26 | 14 | $self = $self->new(@_); | |||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 13 | die $self; | |||||||||||||||||||||||||||
| 30 | } | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 4 | 1; | |||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | __END__ | ||||||||||||||||||||||||||||