| 1 | package LIVR::Contract::Exception; | ||
| 2 | |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 1 | ▶ | use Carp; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 1 | ▶ | use Data::Dumper; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | |||
| 9 | 1 | our @CARP_NOT = (__PACKAGE__, 'LIVR::Contract'); | |
| 10 | |||
| 11 | use overload | ||
| 12 | 3 | ▶ | 'bool' => sub {1}, |
|
Subroutine
BEGIN: called CC=1 SCAR=0.4
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 13 | 0 | ▶ | '~~' => sub { $_[0]->isa($_[1]) }, |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 14 | 0 | ▶ | '""' => sub { $_[0]->to_string }, |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 15 | 1 | fallback => 1; | |
| 16 | |||
| 17 | |||
| 18 | 3 | ▶ | sub new { |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 19 | 3 | my ($class, %args) = @_; | |
| 20 | |||
| 21 | 3 | local $Carp::Internal{ (__PACKAGE__) } = 1; | |
| 22 | |||
| 23 | return bless { | ||
| 24 | type => $args{type}, | ||
| 25 | errors => $args{errors}, | ||
| 26 | package => $args{package}, | ||
| 27 | subname => $args{subname}, | ||
| 28 | 3 | longmess => Carp::longmess(), | |
| 29 | }, $class; | ||
| 30 | } | ||
| 31 | |||
| 32 | 3 | ▶ | sub type { |
|
Subroutine
type: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 33 | 3 | return shift->{type}; | |
| 34 | } | ||
| 35 | |||
| 36 | 3 | ▶ | sub errors { |
|
Subroutine
errors: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 37 | 3 | return shift->{errors}; | |
| 38 | } | ||
| 39 | |||
| 40 | 3 | ▶ | sub package { |
|
Subroutine
package: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 41 | 3 | return shift->{package}; | |
| 42 | } | ||
| 43 | |||
| 44 | 3 | ▶ | sub subname { |
|
Subroutine
subname: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 45 | 3 | return shift->{subname}; | |
| 46 | } | ||
| 47 | |||
| 48 | 0 | ▶ | sub longmess { |
|
Subroutine
longmess: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 49 | 0 | return shift->{longmess}; | |
| 50 | } | ||
| 51 | |||
| 52 | 0 | ▶ | sub to_string { |
|
Subroutine
to_string: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 53 | 0 | my $self = shift; | |
| 54 | |||
| 55 | 0 | local $Data::Dumper::Indent = 0; | |
| 56 | 0 | my $errors_str = Data::Dumper->Dump([$self->errors], ['errors']); | |
| 57 | |||
| 58 | 0 | return "Wrong $self->{type} in package=[$self->{package}] subname=[$self->{subname}]. $errors_str"; | |
| 59 | } | ||
| 60 | |||
| 61 | 1 | 1; | |