Framework/Errorcodes.pm

filter: Statementstmt 68.7% 11 / 16 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod n/a totaltotal 58.3% 14 / 24 CC 3 SCAR 18.7
CC
3
Cov
55%
c2m
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 6.5
« Framework/Config.pm ↑ Summary Framework/DB.pm »
1 #!/usr/bin/perl -Ilib -w
2  
3 # error codes - derived from RFC4930 (EPP)
4  
5 package Net::Server::Framework::Errorcodes;
6  
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 our ($VERSION) = '1.1';
12  
13 0 ▶sub c2m {
Subroutine c2m: not called CC=3 SCAR=24.8
14 0 my $code = shift;
15 0 ▶ carp "No error code defined" unless defined $code;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $code 0 0 0
16  
17 0 my $errors = {
18 1000 => "Command completed successfully",
19 1001 => "Command completed successfully; action pending",
20 1300 => "Command completed successfully; no messages",
21 1301 => "Command completed successfully; ack to dequeue",
22 1500 => "Command completed successfully; ending session",
23 2000 => "Unknown command",
24 2001 => "Command syntax error",
25 2002 => "Command use error",
26 2003 => "Required parameter missing",
27 2004 => "Parameter value range error",
28 2005 => "Parameter value syntax error",
29 2100 => "Unimplemented protocol version",
30 2101 => "Unimplemented command",
31 2102 => "Unimplemented option",
32 2103 => "Unimplemented extension",
33 2104 => "Billing failure",
34 2105 => "Object is not eligible for renewal",
35 2106 => "Object is not eligible for transfer",
36 2200 => "Authentication error",
37 2201 => "Authorization error",
38 2202 => "Invalid authorization information",
39 2300 => "Object pending transfer",
40 2301 => "Object not pending transfer",
41 2302 => "Object exists",
42 2303 => "Object does not exist",
43 2304 => "Object status prohibits operation",
44 2305 => "Object association prohibits operation",
45 2306 => "Parameter value policy error",
46 2307 => "Unimplemented object service",
47 2308 => "Data management policy violation",
48 2400 => "Command failed",
49 2500 => "Command failed; server closing connection",
50 2501 => "Authentication error; server closing connection",
51 2502 => "Session limit exceeded; server closing connection",
52 };
53 return 'Undefined Error'
54 0 ▶ unless defined $errors->{$code};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $errors->{$code} 0 0 0
55 0 return $errors->{$code};
56 }
57  
58 1 1;
59  
60 =head1 NAME
61  
62 Net::Server::Framework::Errorcodes - Mapping lib for error codes to
63 messages
64  
65  
66 =head1 VERSION
67  
68 This documentation refers to Net::Server::Framework::Errorcodes version 1.1.
69  
70  
71 =head1 SYNOPSIS
72  
73 A typical invocation looks like this:
74  
75 my $message = Net::Server::Framework::Errorcodes::c2m($code);
76  
77 =head1 DESCRIPTION
78  
79 This is a lib for matching error codes to human readable error messages.
80 it is used by the C<Net::Server::framework::Format> lib. The error codes
81 are based on the EPP error codes common in the domain name industry.
82  
83 =head1 BASIC METHODS
84  
85 The commands accepted by the lib are:
86  
87 =head2 c2m
88  
89 Takes an error code and returns a error message in human readable form.
90  
91 =head1 BUGS AND LIMITATIONS
92  
93 There are no known bugs in this module.
94 Please report problems to
95 Lenz Gschwendtner ( <lenz@springtimesoft.com> )
96 Patches are welcome.
97  
98 =head1 AUTHOR
99  
100 Lenz Gschwendtner ( <lenz@springtimesoft.com> )
101  
102  
103  
104 =head1 LICENCE AND COPYRIGHT
105  
106 Copyright (c)
107 2007 Lenz Gschwerndtner ( <lenz@springtimesoft.comn> )
108 All rights reserved.
109  
110 This module is free software; you can redistribute it and/or
111 modify it under the same terms as Perl itself. See L<perlartistic>.
112  
113 This program is distributed in the hope that it will be useful,
114 but WITHOUT ANY WARRANTY; without even the implied warranty of
115 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
« Framework/Config.pm ↑ Summary Framework/DB.pm »