line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dancer::Serializer::Abstract; |
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:SUKRIA'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Base serialiser class for Dancer |
4
|
|
|
|
|
|
|
$Dancer::Serializer::Abstract::VERSION = '1.3521'; |
5
|
165
|
|
|
165
|
|
1431
|
use strict; |
|
165
|
|
|
|
|
380
|
|
|
165
|
|
|
|
|
4583
|
|
6
|
165
|
|
|
165
|
|
952
|
use warnings; |
|
165
|
|
|
|
|
413
|
|
|
165
|
|
|
|
|
3691
|
|
7
|
165
|
|
|
165
|
|
812
|
use Carp; |
|
165
|
|
|
|
|
440
|
|
|
165
|
|
|
|
|
8574
|
|
8
|
165
|
|
|
165
|
|
1157
|
use base 'Dancer::Engine'; |
|
165
|
|
|
|
|
424
|
|
|
165
|
|
|
|
|
45133
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
0
|
706
|
sub serialize { confess 'must be implemented' } |
11
|
1
|
|
|
1
|
0
|
607
|
sub deserialize { confess 'must be implemented' } |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# must be implemented to declare if the serializer can be used or not |
14
|
|
|
|
|
|
|
# most of the time, just use : |
15
|
|
|
|
|
|
|
# Dancer::ModuleLoader->load('Your::Serializer::Deps'); |
16
|
1
|
|
|
1
|
0
|
457
|
sub loaded {0} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# should be implemented, fallback to text/plain if not |
19
|
4
|
|
|
4
|
0
|
20
|
sub content_type {'text/plain'} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# most serializer don't have to overload this one |
22
|
|
|
|
|
|
|
sub support_content_type { |
23
|
30
|
|
|
30
|
0
|
76
|
my ($self, $ct) = @_; |
24
|
30
|
100
|
|
|
|
110
|
return unless $ct; |
25
|
11
|
|
|
|
|
44
|
my @toks = split ';', $ct; |
26
|
11
|
|
|
|
|
31
|
$ct = lc($toks[0]); |
27
|
11
|
|
|
|
|
35
|
return $ct eq $self->content_type; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
1; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
__END__ |