blib/lib/DBIx/Class/InflateColumn/Serializer/Sereal.pm

filter: Statementstmt 100% 32 / 32 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod 100% 2 / 2 totaltotal 100% 49 / 49 CC 3 SCAR 2.7
CC
3
Cov
100%
get_freezer
2.0
__ANON__
2.0
BEGIN
1.0
CRAP 1.3
↑ Summary
1 4 ▶use 5.006; # our
Subroutine BEGIN: called CC=1 SCAR=0.0
2 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package DBIx::Class::InflateColumn::Serializer::Sereal;
6  
7 4 our $VERSION = '0.001002';
8  
9 # ABSTRACT: Sereal based Serialization for DBIx Class Columns
10  
11 4 our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY
12  
13 4 ▶use Sereal::Encoder 2.070000 qw( sereal_encode_with_object );
Subroutine BEGIN: called CC=1 SCAR=0.0
14 4 ▶use Sereal::Decoder 2.070000 qw( sereal_decode_with_object );
Subroutine BEGIN: called CC=1 SCAR=0.0
15 4 ▶use Carp qw( croak );
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 3 ▶sub get_freezer {
Subroutine get_freezer: called CC=2 SCAR=6.9
Pod documented
18 3 my ( undef, undef, $col_info, undef ) = @_;
19 3 my $encoder = Sereal::Encoder->new();
20 3 ▶ if ( defined $col_info->{'size'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $col_info->{"size"}) 2 1 3
21 2 ▶ return sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
22 2 my $v = sereal_encode_with_object( $encoder, $_[0] );
23 croak('Value Serialization is too big')
24 2 ▶ if length($v) > $col_info->{'size'};
Branch: 1 branch
BranchTrueFalseTotal
if length $v > $col_info->{"size"} 1 1 2
25 1 return $v;
26 2 };
27 }
28 1 ▶ return sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
29 1 return sereal_encode_with_object( $encoder, $_[0] );
30 1 };
31 }
32  
33 3 ▶sub get_unfreezer {
Subroutine get_unfreezer: called CC=1 SCAR=0.0
Pod documented
34 3 my $decoder = Sereal::Decoder->new();
35 2 ▶ return sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
36 2 return sereal_decode_with_object( $decoder, $_[0] );
37 3 };
38 }
39  
40 4 1;
41  
42 __END__
↑ Summary