| line | stmt | bran | cond | sub | pod | time | code | 
| 1 | 4 |  |  | 4 |  | 65779 | use 5.006;    # our | 
|  | 4 |  |  |  |  | 11 |  | 
| 2 | 4 |  |  | 4 |  | 14 | use strict; | 
|  | 4 |  |  |  |  | 5 |  | 
|  | 4 |  |  |  |  | 62 |  | 
| 3 | 4 |  |  | 4 |  | 18 | use warnings; | 
|  | 4 |  |  |  |  | 5 |  | 
|  | 4 |  |  |  |  | 221 |  | 
| 4 |  |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | package DBIx::Class::InflateColumn::Serializer::Sereal; | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | our $VERSION = '0.001002'; | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | # ABSTRACT: Sereal based Serialization for DBIx Class Columns | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | our $AUTHORITY = 'cpan:KENTNL'; # AUTHORITY | 
| 12 |  |  |  |  |  |  |  | 
| 13 | 4 |  |  | 4 |  | 13 | use Sereal::Encoder 2.070000 qw( sereal_encode_with_object ); | 
|  | 4 |  |  |  |  | 69 |  | 
|  | 4 |  |  |  |  | 243 |  | 
| 14 | 4 |  |  | 4 |  | 16 | use Sereal::Decoder 2.070000 qw( sereal_decode_with_object ); | 
|  | 4 |  |  |  |  | 51 |  | 
|  | 4 |  |  |  |  | 188 |  | 
| 15 | 4 |  |  | 4 |  | 15 | use Carp qw( croak ); | 
|  | 4 |  |  |  |  | 5 |  | 
|  | 4 |  |  |  |  | 757 |  | 
| 16 |  |  |  |  |  |  |  | 
| 17 |  |  |  |  |  |  | sub get_freezer { | 
| 18 | 3 |  |  | 3 | 1 | 8974 | my ( undef, undef, $col_info, undef ) = @_; | 
| 19 | 3 |  |  |  |  | 33 | my $encoder = Sereal::Encoder->new(); | 
| 20 | 3 | 100 |  |  |  | 14 | if ( defined $col_info->{'size'} ) { | 
| 21 |  |  |  |  |  |  | return sub { | 
| 22 | 2 |  |  | 2 |  | 1590029 | my $v = sereal_encode_with_object( $encoder, $_[0] ); | 
| 23 |  |  |  |  |  |  | croak('Value Serialization is too big') | 
| 24 | 2 | 100 |  |  |  | 306 | if length($v) > $col_info->{'size'}; | 
| 25 | 1 |  |  |  |  | 6 | return $v; | 
| 26 | 2 |  |  |  |  | 8 | }; | 
| 27 |  |  |  |  |  |  | } | 
| 28 |  |  |  |  |  |  | return sub { | 
| 29 | 1 |  |  | 1 |  | 408594 | return sereal_encode_with_object( $encoder, $_[0] ); | 
| 30 | 1 |  |  |  |  | 4 | }; | 
| 31 |  |  |  |  |  |  | } | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | sub get_unfreezer { | 
| 34 | 3 |  |  | 3 | 1 | 31 | my $decoder = Sereal::Decoder->new(); | 
| 35 |  |  |  |  |  |  | return sub { | 
| 36 | 2 |  |  | 2 |  | 547508 | return sereal_decode_with_object( $decoder, $_[0] ); | 
| 37 | 3 |  |  |  |  | 11 | }; | 
| 38 |  |  |  |  |  |  | } | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | 1; | 
| 41 |  |  |  |  |  |  |  | 
| 42 |  |  |  |  |  |  | __END__ |