| 1 | package Mongol::Model; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use Moose; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | 1 | ▶ | use MooseX::Storage; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 1 | ▶ | use MooseX::Storage::Engine; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 1 | with Storage( base => 'SerializedClass' ); | |||||||||
| 9 | |||||||||||
| 10 | 1 | my @MAPPED_CLASSES = qw( | |||||||||
| 11 | BSON::OID | ||||||||||
| 12 | BSON::DBRef | ||||||||||
| 13 | BSON::Bytes | ||||||||||
| 14 | BSON::Regex | ||||||||||
| 15 | DateTime | ||||||||||
| 16 | ); | ||||||||||
| 17 | |||||||||||
| 18 | MooseX::Storage::Engine->add_custom_type_handler( | ||||||||||
| 19 | $_ => ( | ||||||||||
| 20 | 0 | ▶ | expand => sub { shift() }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 21 | 0 | ▶ | collapse => sub { shift() }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 22 | ) | ||||||||||
| 23 | 1 | ) foreach ( @MAPPED_CLASSES ); | |||||||||
| 24 | |||||||||||
| 25 | 4 | ▶ | around 'pack' => sub { | ||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||
| 26 | 4 | my $orig = shift(); | |||||||||
| 27 | 4 | my $self = shift(); | |||||||||
| 28 | |||||||||||
| 29 | 4 | my %args = @_; | |||||||||
| 30 | |||||||||||
| 31 | 4 | my $result = $self->$orig( %args ); | |||||||||
| 32 | delete( $result->{__CLASS__} ) | ||||||||||
| 33 | 4 | ▶ | if( $args{no_class} ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 34 | |||||||||||
| 35 | 4 | return $result; | |||||||||
| 36 | 1 | }; | |||||||||
| 37 | |||||||||||
| 38 | 1 | ▶ | sub serialize { | ||||||||
|
Subroutine
serialize: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 39 | 1 | my $self = shift(); | |||||||||
| 40 | |||||||||||
| 41 | 1 | return $self->pack( no_class => 1 ); | |||||||||
| 42 | } | ||||||||||
| 43 | |||||||||||
| 44 | 1 | __PACKAGE__->meta()->make_immutable(); | |||||||||
| 45 | |||||||||||
| 46 | 1 | 1; | |||||||||
| 47 | |||||||||||
| 48 | __END__ | ||||||||||