| 1 | package DBIO::InflateColumn::Serializer; | ||||||||||
| 2 | # ABSTRACT: Inflators to serialize data structures for DBIO | ||||||||||
| 3 | |||||||||||
| 4 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 3 | our $VERSION = '0.900007'; | |||||||||
| 8 | |||||||||||
| 9 | 3 | ▶ | use DBIO::Util (); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 3 | ▶ | use namespace::clean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | |||||||||||
| 13 | 2 | ▶ | sub register_column { | ||||||||
|
Subroutine
register_column: called CC=5 SCAR=20.4
Pod
documented
| |||||||||||
| 14 | 2 | my $self = shift; | |||||||||
| 15 | 2 | my ($column, $info, $args) = @_; | |||||||||
| 16 | 2 | $self->next::method(@_); | |||||||||
| 17 | |||||||||||
| 18 | 2 | ▶ | return unless defined $info->{'serializer_class'}; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 19 | |||||||||||
| 20 | 1 | my $class = "DBIO::InflateColumn::Serializer::$info->{'serializer_class'}"; | |||||||||
| 21 | 1 | DBIO::Util::assert_class_name($class); | |||||||||
| 22 | 1 | eval "require ${class};"; | |||||||||
| 23 | 1 | ▶ | $self->throw_exception("Failed to use serializer_class '${class}': $@") if $@; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | |||||||||||
| 25 | 0 | ▶ | defined( my $freezer = eval{ $class->get_freezer($column, $info, $args) }) || | ||||||||
|
Branch: 1 branch
| |||||||||||
| 26 | $self->throw_exception("Failed to create freezer with class '$class': $@"); | ||||||||||
| 27 | 0 | ▶ | defined( my $unfreezer = eval{ $class->get_unfreezer($column, $info, $args) }) || | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | $self->throw_exception("Failed to create unfreezer with class '$class': $@"); | ||||||||||
| 29 | |||||||||||
| 30 | 0 | $self->inflate_column( | |||||||||
| 31 | $column => { | ||||||||||
| 32 | inflate => $unfreezer, | ||||||||||
| 33 | deflate => $freezer, | ||||||||||
| 34 | } | ||||||||||
| 35 | ); | ||||||||||
| 36 | }; | ||||||||||
| 37 | |||||||||||
| 38 | |||||||||||
| 39 | 3 | 1; | |||||||||
| 40 | |||||||||||
| 41 | __END__ | ||||||||||