| 1 | 7 | ▶ | use 5.12.1; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | 7 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 7 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | package Opsview::RestAPI::Exception; | ||||||||||
| 6 | 7 | $Opsview::RestAPI::Exception::VERSION = '1.210260'; | |||||||||
| 7 | # ABSTRACT: Opsview::RestAPI Exception object | ||||||||||
| 8 | |||||||||||
| 9 | |||||||||||
| 10 | use overload | ||||||||||
| 11 | 5 | ▶ | bool => sub {1}, | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 12 | 2 | ▶ | eq => sub { $_[0]->as_string }, | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 13 | 0 | ▶ | '""' => sub { $_[0]->as_string }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 14 | 7 | ▶ | "0+" => sub {1}; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.2
Subroutine
__ANON__: not called CC=1 SCAR=0.2
| |||||||||||
| 15 | |||||||||||
| 16 | |||||||||||
| 17 | sub new { | ||||||||||
| 18 | 8 | ▶ | my ( $class, %args ) = @_; | ||||||||
|
Subroutine
new: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 19 | |||||||||||
| 20 | 8 | my @caller_keys = ( | |||||||||
| 21 | qw/ package filename line subroutine hasargs wantarray evaltext is_require / | ||||||||||
| 22 | ); | ||||||||||
| 23 | #hints bitmask hinthash / | ||||||||||
| 24 | |||||||||||
| 25 | # Build up the callstack to a max of 7 levels | ||||||||||
| 26 | 8 | my $i=0; | |||||||||
| 27 | 8 | ▶ | do { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | 56 | my @caller = (caller($i++)); | |||||||||
| 29 | 56 | ▶ | return unless(@caller); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | |||||||||||
| 31 | 56 | push( @{ $args{callstack} }, { map { $caller_keys[$_] => $caller[$_] } ( 0 .. $#caller_keys) } ); | |||||||||
| 32 | } while ( $i < 7 ); | ||||||||||
| 33 | |||||||||||
| 34 | 8 | bless { %args }, $class; | |||||||||
| 35 | } | ||||||||||
| 36 | |||||||||||
| 37 | |||||||||||
| 38 | 5 | ▶ | sub line { $_[0]->{callstack}[0]{line} } | ||||||||
|
Subroutine
line: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 39 | 2 | ▶ | sub path { $_[0]->{callstack}[0]{filename} } | ||||||||
|
Subroutine
path: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 40 | 3 | ▶ | sub filename { $_[0]->{callstack}[0]{filename} } | ||||||||
|
Subroutine
filename: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 41 | 0 | ▶ | sub package { $_[0]->{callstack}[0]{package} } | ||||||||
|
Subroutine
package: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 42 | |||||||||||
| 43 | |||||||||||
| 44 | sub message { | ||||||||||
| 45 | 15 | ▶ | return $_[0]->{message}; | ||||||||
|
Subroutine
message: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 46 | } | ||||||||||
| 47 | |||||||||||
| 48 | |||||||||||
| 49 | sub http_code { | ||||||||||
| 50 | 13 | ▶ | return $_[0]->{http_code}; | ||||||||
|
Subroutine
http_code: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 51 | } | ||||||||||
| 52 | |||||||||||
| 53 | |||||||||||
| 54 | sub as_string { | ||||||||||
| 55 | 2 | ▶ | my $self = shift; | ||||||||
|
Subroutine
as_string: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 56 | |||||||||||
| 57 | 2 | return sprintf( "Error: %s at %s line %s.\n", | |||||||||
| 58 | $self->message, $self->path, $self->line ); | ||||||||||
| 59 | } | ||||||||||
| 60 | |||||||||||
| 61 | |||||||||||
| 62 | 7 | 1; | |||||||||
| 63 | |||||||||||
| 64 | __END__ | ||||||||||