File Coverage

blib/lib/KiokuDB/TypeMap/Default/Passthrough.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 20 20 100.0


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2              
3             package KiokuDB::TypeMap::Default::Passthrough;
4 22     22   12491 use Moose::Role;
  22         44  
  22         149  
5              
6 22     22   87592 use namespace::clean -except => 'meta';
  22         46  
  22         152  
7              
8             with qw(KiokuDB::TypeMap::Default);
9              
10             sub _build_datetime_typemap {
11 47     47   3513 my $self = shift;
12              
13 47         467 $self->_create_typemap(
14             isa_entries => {
15             'DateTime' => => {
16             type => 'KiokuDB::TypeMap::Entry::Passthrough',
17             intrinsic => 1,
18             },
19             'DateTime::Duration' => => {
20             type => 'KiokuDB::TypeMap::Entry::Passthrough',
21             intrinsic => 1,
22             },
23             },
24             );
25             }
26              
27             sub _build_path_class_typemap {
28 47     47   3413 my $self = shift;
29              
30 47         380 $self->_create_typemap(
31             isa_entries => {
32             'Path::Class::Entity' => {
33             type => "KiokuDB::TypeMap::Entry::Passthrough",
34             intrinsic => 1,
35             },
36             },
37             );
38             }
39              
40             sub _build_uri_typemap {
41 47     47   3501 my $self = shift;
42              
43 47         466 $self->_create_typemap(
44             isa_entries => {
45             'URI' => {
46             type => "KiokuDB::TypeMap::Entry::Passthrough",
47             intrinsic => 1,
48             },
49             },
50             entries => {
51             'URI::WithBase' => {
52             type => "KiokuDB::TypeMap::Entry::Passthrough",
53             intrinsic => 1,
54             },
55             },
56             );
57             }
58              
59             sub _build_authen_passphrase_typemap {
60 47     47   3516 my $self = shift;
61              
62 47         414 $self->_create_typemap(
63             isa_entries => {
64             # since Authen::Passphrase dynamically loads subcomponents based on
65             # type, passthrough causes issues with the class not being defined
66             # at load time unless explicitly loaded by the user.
67             # this works around this issue
68             #'Authen::Passphrase' => {
69             # type => "KiokuDB::TypeMap::Entry::Passthrough",
70             # intrinsic => 1,
71             #},
72             'Authen::Passphrase' => {
73             type => "KiokuDB::TypeMap::Entry::Callback",
74             intrinsic => 1,
75             collapse => "as_rfc2307",
76             expand => "from_rfc2307",
77             },
78             },
79             );
80             }
81              
82             __PACKAGE__
83              
84             __END__
85              
86             =pod
87              
88             =head1 NAME
89              
90             KiokuDB::TypeMap::Default::Passthrough - A L<KiokuDB::TypeMap::Default>
91             instance suitable for L<Storable>.
92              
93             =head1 DESCRIPTION
94              
95             This typemap lets most of the default data types be passed through untouched,
96             so that their own L<Storable> hooks may be invoked.