| 1 | package Dancer::Serializer::Abstract; | ||||||||||
| 2 | 183 | our $AUTHORITY = 'cpan:SUKRIA'; | |||||||||
| 3 | # ABSTRACT: Base serialiser class for Dancer | ||||||||||
| 4 | 183 | $Dancer::Serializer::Abstract::VERSION = '1.3522'; | |||||||||
| 5 | 183 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 183 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 183 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 183 | ▶ | use base 'Dancer::Engine'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 1 | ▶ | sub serialize { confess 'must be implemented' } | ||||||||
|
Subroutine
serialize: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 11 | 1 | ▶ | sub deserialize { confess 'must be implemented' } | ||||||||
|
Subroutine
deserialize: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 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 | ▶ | sub loaded {0} | ||||||||
|
Subroutine
loaded: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 17 | |||||||||||
| 18 | # should be implemented, fallback to text/plain if not | ||||||||||
| 19 | 4 | ▶ | sub content_type {'text/plain'} | ||||||||
|
Subroutine
content_type: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 20 | |||||||||||
| 21 | # most serializer don't have to overload this one | ||||||||||
| 22 | 30 | ▶ | sub support_content_type { | ||||||||
|
Subroutine
support_content_type: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 23 | 30 | my ($self, $ct) = @_; | |||||||||
| 24 | 30 | ▶ | return unless $ct; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 11 | my @toks = split ';', $ct; | |||||||||
| 26 | 11 | $ct = lc($toks[0]); | |||||||||
| 27 | 11 | return $ct eq $self->content_type; | |||||||||
| 28 | } | ||||||||||
| 29 | |||||||||||
| 30 | 183 | 1; | |||||||||
| 31 | |||||||||||
| 32 | __END__ | ||||||||||