| 1 | package Langertha::Holmgang::Error; | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: A loud refusal of input: the field path and the reason | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 54 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 54 | ▶ | use Carp qw( croak ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 54 | ▶ | use Scalar::Util qw( blessed ); | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | 54 | ▶ | use overload '""' => sub { $_[0]->field.': '.$_[0]->reason }, fallback => 1; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 54 | ▶ | use namespace::autoclean; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 54 | our $VERSION = '0.001'; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 54 | has field => ( is => 'ro', required => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | 54 | has reason => ( is => 'ro', required => 1 ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 217 | ▶ | sub throw { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
throw: called CC=1 SCAR=1.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | ▶ | my ( $class, $field, $reason ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
throw: not called CC=1 SCAR=1.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | croak $class->new( field => $field, reason => $reason ); | |||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 181 | ▶ | sub caught { | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
caught: called CC=3 SCAR=14.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 0 | ▶ | my ( $class, $err ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
caught: not called CC=3 SCAR=14.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | return blessed $err && $err->isa($class) ? $err : undef; | ||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition50%3/6
builtin::blessed($err) and $err->isa($class)
builtin::blessed($err) and $err->isa($class)
MC/DC100%2/2
builtin::blessed($err) and $err->isa($class)
builtin::blessed($err)
$err->isa($class)
MC/DC0%0/2
builtin::blessed($err) and $err->isa($class)
builtin::blessed($err)
$err->isa($class)
Truth table100%3/3
A and B
A= builtin::blessed($err)B= $err->isa($class)
Truth table0%0/3
A and B
A= builtin::blessed($err)B= $err->isa($class)
| |||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 54 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||