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.3514_04'; # TRIAL |
5
|
|
|
|
|
|
|
$Dancer::Serializer::Abstract::VERSION = '1.351404'; |
6
|
166
|
|
|
166
|
|
1651
|
use strict; |
|
166
|
|
|
|
|
342
|
|
|
166
|
|
|
|
|
3849
|
|
7
|
166
|
|
|
166
|
|
745
|
use warnings; |
|
166
|
|
|
|
|
308
|
|
|
166
|
|
|
|
|
3020
|
|
8
|
166
|
|
|
166
|
|
680
|
use Carp; |
|
166
|
|
|
|
|
316
|
|
|
166
|
|
|
|
|
7619
|
|
9
|
166
|
|
|
166
|
|
932
|
use base 'Dancer::Engine'; |
|
166
|
|
|
|
|
352
|
|
|
166
|
|
|
|
|
38443
|
|
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
0
|
780
|
sub serialize { confess 'must be implemented' } |
12
|
1
|
|
|
1
|
0
|
740
|
sub deserialize { confess 'must be implemented' } |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# must be implemented to declare if the serializer can be used or not |
15
|
|
|
|
|
|
|
# most of the time, just use : |
16
|
|
|
|
|
|
|
# Dancer::ModuleLoader->load('Your::Serializer::Deps'); |
17
|
1
|
|
|
1
|
0
|
574
|
sub loaded {0} |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# should be implemented, fallback to text/plain if not |
20
|
4
|
|
|
4
|
0
|
17
|
sub content_type {'text/plain'} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# most serializer don't have to overload this one |
23
|
|
|
|
|
|
|
sub support_content_type { |
24
|
30
|
|
|
30
|
0
|
70
|
my ($self, $ct) = @_; |
25
|
30
|
100
|
|
|
|
112
|
return unless $ct; |
26
|
11
|
|
|
|
|
52
|
my @toks = split ';', $ct; |
27
|
11
|
|
|
|
|
28
|
$ct = lc($toks[0]); |
28
|
11
|
|
|
|
|
35
|
return $ct eq $self->content_type; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__END__ |