Serialized/Exceptions.pm

filter: Statementstmt 90.4% 38 / 42 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 78.5% 11 / 14 Podpod 0.0% 0 / 1 totaltotal 84.7% 50 / 59 CC 2 SCAR 2.0
CC
2
Cov
89%
carp
2.5
__ANON__
1.1
__ANON__
1.1
CRAP 1.2
« Serialized/Config.pm ↑ Summary Serialized/AuthzHandler.pm »
1 #
2 # $HeadURL: https://svn.oucs.ox.ac.uk/people/oliver/pub/librpc-serialized-perl/trunk/lib/RPC/Serialized/Exceptions.pm $
3 # $LastChangedRevision: 1361 $
4 # $LastChangedDate: 2008-10-01 16:16:56 +0100 (Wed, 01 Oct 2008) $
5 # $LastChangedBy: oliver $
6 #
7 package RPC::Serialized::Exceptions;
8 {
9 34 $RPC::Serialized::Exceptions::VERSION = '1.123630';
10 }
11  
12 34 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 34 ▶use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 34 ▶use Symbol;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 80 ▶sub import {
Subroutine import: called CC=1 SCAR=0.1
17  
18 # Exception::Class looks at caller() to insert raise_error into that
19 # Namespace, so this hack means whoever use's us, they get a raise_error
20 # of their very own.
21  
22 80 *{Symbol::qualify_to_ref('throw_proto',caller())}
23 80 ▶ = sub { RPC::Serialized::X::Protocol->throw(@_) };
Subroutine __ANON__: called CC=1 SCAR=0.0
24  
25 80 *{Symbol::qualify_to_ref('throw_parse',caller())}
26 0 ▶ = sub { RPC::Serialized::X::Parse->throw(@_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
27  
28 80 *{Symbol::qualify_to_ref('throw_invalid',caller())}
29 0 ▶ = sub { RPC::Serialized::X::Validation->throw(@_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
30  
31 80 *{Symbol::qualify_to_ref('throw_system',caller())}
32 80 ▶ = sub { RPC::Serialized::X::System->throw(@_) };
Subroutine __ANON__: called CC=1 SCAR=0.0
33  
34 80 *{Symbol::qualify_to_ref('throw_app',caller())}
35 80 ▶ = sub { RPC::Serialized::X::Application->throw(@_) };
Subroutine __ANON__: called CC=1 SCAR=0.0
36  
37 80 *{Symbol::qualify_to_ref('throw_authz',caller())}
38 0 ▶ = sub { RPC::Serialized::X::Authorization->throw(@_) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
39  
40 # this is to quiesce Carp::carp which is called from within Data::Serializer
41 # and turn its output into Carp::croak.
42  
43 34 ▶ use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
44 {
45 34 ▶ no warnings 'redefine';
Subroutine BEGIN: called CC=1 SCAR=0.0
46 3 ▶ sub Carp::carp {
Subroutine carp: called CC=2 SCAR=9.2
Pod undocumented
47 3 ▶ die Carp::shortmess @_ if (caller)[0] =~ m/Data::Serializer/;
Branch: 1 branch
BranchTrueFalseTotal
if (caller)[0] =~ /Data::Serializer/ 3 0 3
48 0 warn Carp::shortmess @_;
49 }
50 }
51 80 }
52  
53 34 ▶use Exception::Class (
Subroutine BEGIN: called CC=1 SCAR=0.0
54 34 'RPC::Serialized::X',
55  
56 'RPC::Serialized::X::Protocol',
57 { isa => 'RPC::Serialized::X',
58 description => 'RPC protocol error',
59 alias => 'throw_proto',
60 },
61  
62 'RPC::Serialized::X::Parse',
63 { isa => 'RPC::Serialized::X',
64 description => 'Data::Serializer parse error',
65 alias => 'throw_parse',
66 },
67  
68 'RPC::Serialized::X::Validation',
69 { isa => 'RPC::Serialized::X',
70 description => 'Data validation error',
71 alias => 'throw_invalid',
72 },
73  
74 'RPC::Serialized::X::System',
75 { isa => 'RPC::Serialized::X',
76 description => 'System error',
77 alias => 'throw_system',
78 },
79  
80 'RPC::Serialized::X::Application',
81 { isa => 'RPC::Serialized::X',
82 description => 'Application programming error',
83 alias => 'throw_app',
84 },
85  
86 'RPC::Serialized::X::Authorization',
87 { isa => 'RPC::Serialized::X',
88 description => 'Authorization failed',
89 alias => 'throw_authz',
90 }
91  
92 34 );
93  
94 34 1;
95  
« Serialized/Config.pm ↑ Summary Serialized/AuthzHandler.pm »