| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Net::Dynect::REST::Response::Msg; |
|
2
|
|
|
|
|
|
|
# $Id: Msg.pm 128 2010-09-24 05:15:58Z james $ |
|
3
|
1
|
|
|
1
|
|
6
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
37
|
|
|
4
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
41
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use overload '""' => \&_as_string; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
9
|
|
|
6
|
1
|
|
|
1
|
|
57
|
use Carp; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
1076
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = do { my @r = (q$Revision: 128 $ =~ /\d+/g); sprintf "%d."."%03d" x $#r, @r }; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Net::Dynect::REST::Response::Msg - A message about the data that was returned. |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use Net::Dynect::REST::Response::Msg; |
|
16
|
|
|
|
|
|
|
$msg = Net::Dynect::REST::Response::Msg->new(); |
|
17
|
|
|
|
|
|
|
$source = $msg->source; |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 METHODS |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=head2 Creating |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=over 4 |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=item new |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
This constructor takes the fields as returned by the response from Dynect to populate the attributes. As this matches the Dynect case and spelling, these are a hash ref with keys: |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=over 4 |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=item * SOURCE |
|
32
|
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=item * LVL |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=item * INFO |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=item * ERR_CD |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=back |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=back |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub new { |
|
46
|
3
|
|
|
3
|
1
|
5
|
my $proto = shift; |
|
47
|
3
|
|
33
|
|
|
21
|
my $self = bless {}, ref($proto) || $proto; |
|
48
|
3
|
|
|
|
|
5
|
my $data = shift; |
|
49
|
|
|
|
|
|
|
|
|
50
|
3
|
50
|
|
|
|
17
|
$self->source( $data->{SOURCE} ) if defined $data->{SOURCE}; |
|
51
|
3
|
50
|
|
|
|
15
|
$self->level( $data->{LVL} ) if defined $data->{LVL}; |
|
52
|
3
|
50
|
|
|
|
47
|
$self->info( $data->{INFO} ) if defined $data->{INFO}; |
|
53
|
3
|
50
|
|
|
|
15
|
$self->err_cd( $data->{ERR_CD} ) if defined $data->{ERR_CD}; |
|
54
|
|
|
|
|
|
|
|
|
55
|
3
|
|
|
|
|
12
|
return $self; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head2 Attributes |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
=over 4 |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=item source |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
A debugging field. If reporting an error to your Dynect Concierge, be sure to include this. |
|
65
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=cut |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
sub source { |
|
69
|
9
|
|
|
9
|
1
|
11
|
my $self = shift; |
|
70
|
9
|
100
|
|
|
|
21
|
if (@_) { |
|
71
|
3
|
|
|
|
|
6
|
my $new = shift; |
|
72
|
3
|
|
|
|
|
42
|
$self->{source} = $new; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
9
|
|
|
|
|
33
|
return $self->{source}; |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item level |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
The severity of the message. One of: 'FATAL', 'ERROR', 'WARN', or 'INFO' |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=cut |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub level { |
|
84
|
9
|
|
|
9
|
1
|
13
|
my $self = shift; |
|
85
|
9
|
100
|
|
|
|
23
|
if (@_) { |
|
86
|
3
|
|
|
|
|
5
|
my $new = shift; |
|
87
|
3
|
50
|
|
|
|
13
|
if ( $new !~ /^FATAL|ERROR|WARN|INFO$/ ) { |
|
88
|
0
|
|
|
|
|
0
|
print "Unknown level: $new\n"; |
|
89
|
0
|
|
|
|
|
0
|
return; |
|
90
|
|
|
|
|
|
|
} |
|
91
|
3
|
|
|
|
|
8
|
$self->{level} = $new; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
9
|
|
|
|
|
25
|
return $self->{level}; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=item info |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
The actual message itself. Human readable (English) text. |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=cut |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
sub info { |
|
103
|
12
|
|
|
12
|
1
|
15
|
my $self = shift; |
|
104
|
12
|
100
|
|
|
|
24
|
if (@_) { |
|
105
|
3
|
|
|
|
|
6
|
my $new = shift; |
|
106
|
3
|
|
|
|
|
6
|
$self->{info} = $new; |
|
107
|
|
|
|
|
|
|
} |
|
108
|
12
|
|
|
|
|
41
|
return $self->{info}; |
|
109
|
|
|
|
|
|
|
} |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item err_cd |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
An error code (if appropriate) regarding the message. See the Dynect manual for the set of valid codes. |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=cut |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
sub err_cd { |
|
118
|
9
|
|
|
9
|
1
|
12
|
my $self = shift; |
|
119
|
9
|
100
|
|
|
|
18
|
if (@_) { |
|
120
|
3
|
|
|
|
|
4
|
my $new = shift; |
|
121
|
3
|
50
|
|
|
|
13
|
if ( $new !~ |
|
122
|
|
|
|
|
|
|
/^ILLEGAL_OPERATION|INTERNAL_ERROR|INVALID_DATA|INVALID_REQUEST|INVALID_VERSION|MISSING_DATA|NOT_FOUND|OPERATION_FAILED|PERMISSION_DENIED|SERVICE_UNAVAILABLE|TARGET_EXISTS|UNKNOWN_ERROR$/ |
|
123
|
|
|
|
|
|
|
) |
|
124
|
|
|
|
|
|
|
{ |
|
125
|
0
|
|
|
|
|
0
|
print "Unknown err_cd: $new\n"; |
|
126
|
0
|
|
|
|
|
0
|
return; |
|
127
|
|
|
|
|
|
|
} |
|
128
|
3
|
|
|
|
|
9
|
$self->{err_cd} = $new; |
|
129
|
|
|
|
|
|
|
} |
|
130
|
9
|
|
|
|
|
24
|
return $self->{err_cd}; |
|
131
|
|
|
|
|
|
|
} |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
sub _as_string { |
|
134
|
3
|
|
|
3
|
|
5
|
my $self = shift; |
|
135
|
3
|
|
|
|
|
5
|
my @texts; |
|
136
|
3
|
50
|
|
|
|
9
|
push @texts, sprintf "Source: '%s'", $self->source if defined $self->source; |
|
137
|
3
|
50
|
|
|
|
9
|
push @texts, sprintf "Level: '%s'", $self->level if defined $self->level; |
|
138
|
3
|
50
|
|
|
|
6
|
push @texts, sprintf "Info: '%s'", $self->info if defined $self->info; |
|
139
|
3
|
50
|
|
|
|
6
|
push @texts, sprintf "Err_CD: '%s'", $self->err_cd if defined $self->err_cd; |
|
140
|
3
|
|
|
|
|
52
|
return join( ', ', @texts ); |
|
141
|
|
|
|
|
|
|
} |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=back |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
L, L, L. |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head1 AUTHOR |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
James bromberger, james@rcpt.to |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
154
|
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Copyright (C) 2010 by James Bromberger |
|
156
|
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
|
158
|
|
|
|
|
|
|
it under the same terms as Perl itself, either Perl version 5.10.1 or, |
|
159
|
|
|
|
|
|
|
at your option, any later version of Perl 5 you may have available. |
|
160
|
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=cut |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
1; |