line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
package Net::OBEX::Response::Generic; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
|
5
|
2
|
|
|
2
|
|
13
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
66
|
|
6
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
89
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '1.001001'; # VERSION |
9
|
|
|
|
|
|
|
|
10
|
2
|
|
|
2
|
|
11
|
use Carp; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
141
|
|
11
|
2
|
|
|
2
|
|
19
|
use base 'Class::Data::Accessor'; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
1932
|
|
12
|
|
|
|
|
|
|
__PACKAGE__->mk_classaccessors( qw( headers_length packet info ) ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my %Response_meaning_of_code = _make_response_codes(); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub new { |
18
|
4
|
|
|
4
|
1
|
1289
|
my $class = shift; |
19
|
4
|
|
|
|
|
5
|
my $packet = shift; |
20
|
|
|
|
|
|
|
|
21
|
4
|
|
|
|
|
14
|
my $self = bless {}, $class; |
22
|
|
|
|
|
|
|
|
23
|
4
|
50
|
|
|
|
13
|
if ( defined $packet ) { |
24
|
0
|
|
|
|
|
0
|
$self->packet( $packet ); |
25
|
0
|
|
|
|
|
0
|
$self->info( $self->parse_info( $packet ) ); |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
4
|
|
|
|
|
20
|
return $self; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub parse_info { |
32
|
2
|
|
|
2
|
1
|
17
|
my ( $self, $packet ) = @_; |
33
|
2
|
50
|
|
|
|
9
|
$packet = $self->packet |
34
|
|
|
|
|
|
|
unless defined $packet; |
35
|
|
|
|
|
|
|
|
36
|
2
|
|
|
|
|
2
|
my %info; |
37
|
2
|
|
|
|
|
9
|
@info{ qw( response_code packet_length) } |
38
|
|
|
|
|
|
|
= unpack 'a n', $packet; |
39
|
|
|
|
|
|
|
|
40
|
2
|
|
|
|
|
6
|
@info{qw( response_code response_code_meaning ) } = |
41
|
|
|
|
|
|
|
$self->code_meaning( $info{response_code} ); |
42
|
|
|
|
|
|
|
|
43
|
2
|
|
|
|
|
5
|
$info{headers_length} = $info{packet_length} - 3; |
44
|
2
|
|
|
|
|
7
|
$self->headers_length( $info{headers_length} ); |
45
|
|
|
|
|
|
|
|
46
|
2
|
|
|
|
|
18
|
return $self->info( \%info ); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub code_meaning { |
50
|
4
|
|
|
4
|
1
|
5
|
my ( $class, $code ) = @_; |
51
|
4
|
|
|
|
|
4
|
return @{ $Response_meaning_of_code{ $code } }; |
|
4
|
|
|
|
|
18
|
|
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub _make_response_codes { |
55
|
|
|
|
|
|
|
return ( |
56
|
2
|
|
|
2
|
|
96
|
"\x90" => [ 100, 'Continue' ], |
57
|
|
|
|
|
|
|
"\xA0" => [ 200, 'OK, Success' ], |
58
|
|
|
|
|
|
|
"\xA1" => [ 201, 'Created' ], |
59
|
|
|
|
|
|
|
"\xA2" => [ 202, 'Accepted' ], |
60
|
|
|
|
|
|
|
"\xA3" => [ 203, 'Non-Authoritative Information' ], |
61
|
|
|
|
|
|
|
"\xA4" => [ 204, 'No Content' ], |
62
|
|
|
|
|
|
|
"\xA5" => [ 205, 'Reset Content' ], |
63
|
|
|
|
|
|
|
"\xA6" => [ 206, 'Partial Content' ], |
64
|
|
|
|
|
|
|
"\xB0" => [ 300, 'Multiple Choices' ], |
65
|
|
|
|
|
|
|
"\xB1" => [ 301, 'Moved Permanently' ], |
66
|
|
|
|
|
|
|
"\xB2" => [ 302, 'Moved temporarily' ], |
67
|
|
|
|
|
|
|
"\xB3" => [ 303, 'See Other' ], |
68
|
|
|
|
|
|
|
"\xB4" => [ 304, 'Not modified' ], |
69
|
|
|
|
|
|
|
"\xB5" => [ 305, 'Use Proxy' ], |
70
|
|
|
|
|
|
|
"\xC0" => [ 400, q|Bad Request - server couldn't understand request| ], |
71
|
|
|
|
|
|
|
"\xC1" => [ 401, 'Unauthorized' ], |
72
|
|
|
|
|
|
|
"\xC2" => [ 402, 'Payment required' ], |
73
|
|
|
|
|
|
|
"\xC3" => [ 403, 'Forbidden - operation is understood but refused' ], |
74
|
|
|
|
|
|
|
"\xC4" => [ 404, 'Not Found' ], |
75
|
|
|
|
|
|
|
"\xC5" => [ 405, 'Method not allowed' ], |
76
|
|
|
|
|
|
|
"\xC6" => [ 406, 'Not Acceptable' ], |
77
|
|
|
|
|
|
|
"\xC7" => [ 407, 'Proxy Authentication required' ], |
78
|
|
|
|
|
|
|
"\xC8" => [ 408, 'Request Time Out' ], |
79
|
|
|
|
|
|
|
"\xC9" => [ 409, 'Conflict' ], |
80
|
|
|
|
|
|
|
"\xCA" => [ 410, 'Gone' ], |
81
|
|
|
|
|
|
|
"\xCB" => [ 411, 'Length Required' ], |
82
|
|
|
|
|
|
|
"\xCC" => [ 412, 'Precondition failed' ], |
83
|
|
|
|
|
|
|
"\xCD" => [ 413, 'Requested entity too large' ], |
84
|
|
|
|
|
|
|
"\xCE" => [ 414, 'Request URL too large' ], |
85
|
|
|
|
|
|
|
"\xCF" => [ 415, 'Unsupported media type' ], |
86
|
|
|
|
|
|
|
"\xD0" => [ 500, 'Internal Server Error' ], |
87
|
|
|
|
|
|
|
"\xD1" => [ 501, 'Not Implemented' ], |
88
|
|
|
|
|
|
|
"\xD2" => [ 502, 'Bad Gateway' ], |
89
|
|
|
|
|
|
|
"\xD3" => [ 503, 'Service Unavailable' ], |
90
|
|
|
|
|
|
|
"\xD4" => [ 504, 'Gateway Timeout' ], |
91
|
|
|
|
|
|
|
"\xD5" => [ 505, 'HTTP version not supported' ], |
92
|
|
|
|
|
|
|
"\xE0" => [ undef, 'Database Full' ], |
93
|
|
|
|
|
|
|
"\xE1" => [ undef, 'Database Locked' ], |
94
|
|
|
|
|
|
|
); |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
1; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
__END__ |