line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Dancer2::Serializer::CBOR; |
2
|
|
|
|
|
|
|
# ABSTRACT: CBOR serializer for Dancer2 |
3
|
|
|
|
|
|
|
$Dancer2::Serializer::CBOR::VERSION = '0.000001'; |
4
|
1
|
|
|
1
|
|
40390
|
use Moo; |
|
1
|
|
|
|
|
11979
|
|
|
1
|
|
|
|
|
4
|
|
5
|
1
|
|
|
1
|
|
2652
|
use CBOR::XS (); |
|
1
|
|
|
|
|
3746
|
|
|
1
|
|
|
|
|
129
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
with 'Dancer2::Core::Role::Serializer'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has '+content_type' => ( default => sub {'application/cbor'} ); |
10
|
|
|
|
|
|
|
|
11
|
0
|
|
|
0
|
0
|
|
sub loaded {1} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub serialize { |
14
|
|
|
|
|
|
|
my ($self, $entity) = @_; |
15
|
|
|
|
|
|
|
CBOR::XS::encode_cbor($entity); |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub deserialize { |
19
|
|
|
|
|
|
|
my ($self, $content) = @_; |
20
|
|
|
|
|
|
|
CBOR::XS::decode_cbor($content); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
1; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
__END__ |