| 1 | package WWW::FBX::Error; | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 22 | ▶ | use 5.008001; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 22 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 22 | ▶ | use Try::Tiny; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 22 | ▶ | use Devel::StackTrace; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | #Stringify using error sub | ||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 22 | use overload '""' => \&error, | |||||||||||||||||||||||||||||||||||||||||||||
| 9 | 22 | ▶ | 'fallback' => 1; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||||||
| 12 | 22 | has fbx_error => ( is => 'rw', predicate => 'has_fbx_error' ); | |||||||||||||||||||||||||||||||||||||||||||||
| 13 | 22 | has http_response => ( isa => 'HTTP::Response', is => 'rw', required => 1, handles => [qw/code message/] ); | |||||||||||||||||||||||||||||||||||||||||||||
| 14 | 22 | has stack_trace => ( is => 'ro', init_arg => undef, builder => '_build_stack_trace' ); | |||||||||||||||||||||||||||||||||||||||||||||
| 15 | 22 | has _stringified => ( is => 'rw', init_arg => undef, default => undef ); | |||||||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||||||
| 17 | sub _build_stack_trace { | ||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | ▶ | my $seen; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_build_stack_trace: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | my $this_sub = (caller 0)[3]; | |||||||||||||||||||||||||||||||||||||||||||||
| 20 | Devel::StackTrace->new(frame_filter => sub { | ||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | ▶ | my $caller = shift->{caller}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | my $in_nt = $caller->[0] =~ /^WWW::Net::/ || $caller->[3] eq $this_sub; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$caller->[0] =~ /^WWW::Net::/ || $caller->[3] eq $this_sub
MC/DC0%0/2
$caller->[0] =~ /^WWW::Net::/ || $caller->[3] eq $this_sub
$caller->[0] =~ /^WWW::Net::/
$caller->[3] eq $this_sub
Truth table0%0/3
A || B
A= $caller->[0] =~ /^WWW::Net::/B= $caller->[3] eq $this_sub
| |||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 0 | ▶ | ($seen ||= $in_nt) && !$in_nt || 0; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$seen ||= $in_nt and not $in_nt
$seen ||= $in_nt
MC/DC0%0/3
$seen ||= $in_nt and not $in_nt
$seen
$in_nt
not $in_nt
Truth table0%0/5
A ||= B and not(C)
A= $seenB= $in_ntC= not $in_nt
| |||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 0 | }); | |||||||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||||||
| 27 | sub error { | ||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
error: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | ▶ | return $self->_stringified if $self->_stringified; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||||||
| 32 | # Don't walk on $@ | ||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | local $@; | |||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | my $error = $self->has_fbx_error && $self->fbx_error_text | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/6
$self->has_fbx_error && $self->fbx_error_text || $self->http_response->status_line
$self->has_fbx_error and $self->fbx_error_text
MC/DC0%0/3
$self->has_fbx_error && $self->fbx_error_text || $self->http_response->status_line
$self->has_fbx_error
$self->fbx_error_text
$self->http_response->status_line
Truth table0%0/5
A and B || C
A= $self->has_fbx_errorB= $self->fbx_error_textC= $self->http_response->status_line
| |||||||||||||||||||||||||||||||||||||||||||||||
| 36 | || $self->http_response->status_line; | ||||||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | my ($location) = $self->stack_trace->frame(0)->as_string =~ /( at .*)/; | |||||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | return $self->_stringified($error . ($location || '')); | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$location || ''
MC/DC0%0/1
$location || ''
$location
Truth table0%0/2
A
A= $location
| |||||||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||
| 42 | sub fbx_error_text { | ||||||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fbx_error_text: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | return '' unless $self->has_fbx_error; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | my $e = $self->fbx_error; | |||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||
| 49 | return try { | ||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | exists $e->{msg} && $e->{msg}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | ▶ | } || ''; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
&try(sub { || ''
MC/DC0%0/1
&try(sub {
exists $e->{'msg'} and $e->{'msg'};
}
) || ''
&try(sub {
exists $e->{'msg'} and $e->{'msg'};
}
)
Truth table0%0/2
A
A= &try(sub {
exists $e->{'msg'} and $e->{'msg'};
}
)
| |||||||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||||||
| 55 | sub fbx_error_code { | ||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fbx_error_code: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||||||
| 58 | return $self->has_fbx_error | ||||||||||||||||||||||||||||||||||||||||||||||
| 59 | && exists $self->fbx_error->{error_code} | ||||||||||||||||||||||||||||||||||||||||||||||
| 60 | && $self->fbx_error->{error_code} | ||||||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | || 0; | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/8
$self->has_fbx_error && exists $self->fbx_error->{'error_code'} && $self->fbx_error->{'error_code'} || 0
$self->has_fbx_error and exists $self->fbx_error->{"error_code"} and $self->fbx_error->{"error_code"}
$self->has_fbx_error and exists $self->fbx_error->{"error_code"}
MC/DC0%0/3
$self->has_fbx_error && exists $self->fbx_error->{'error_code'} && $self->fbx_error->{'error_code'} || 0
$self->has_fbx_error
exists $self->fbx_error->{"error_code"}
$self->fbx_error->{"error_code"}
Truth table0%0/4
A and B and C
A= $self->has_fbx_errorB= exists $self->fbx_error->{"error_code"}C= $self->fbx_error->{"error_code"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 22 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 22 | ▶ | no Moose; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||||||
| 69 | 22 | 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 70 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||||||
| 72 | =encoding utf-8 | ||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||
| 74 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||||||
| 76 | WWW::FBX::Error - Freebox Error Handling | ||||||||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||||||
| 78 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||
| 80 | use WWW::FBX::Error; | ||||||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||||||
| 82 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||||||
| 84 | WWW::FBX::Error is FBX Error handling | ||||||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||||||
| 86 | =head1 LICENSE | ||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||
| 88 | Copyright (C) Laurent Kislaire. | ||||||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||||||
| 90 | This library is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||||||||||
| 91 | it under the same terms as Perl itself. | ||||||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||||||
| 93 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||||||||||||||||
| 95 | Laurent Kislaire E<lt>teebeenator@gmail.comE<gt> | ||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||
| 97 | =cut | ||||||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||||||