KiokuDB/TypeMap/Default/Canonical.pm

filter: Statementstmt 88.8% 16 / 18 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod n/a totaltotal 88.0% 22 / 25 CC 1 SCAR 1.5
CC
1
Cov
89%
__ANON__
2.0
_build_datetime_typemap
1.1
BEGIN
1.0
CRAP 1.2
« KiokuDB/TypeMap/Entry/Std/Intrinsic.pm ↑ Summary KiokuDB/Test/Fixture/GIN/Class.pm »
1 #!/usr/bin/perl
2  
3 package KiokuDB::TypeMap::Default::Canonical;
4 7 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 7 ▶use namespace::clean -except => 'meta';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 7 with qw(KiokuDB::TypeMap::Default);
9  
10 sub _build_path_class_typemap {
11 17 ▶ my $self = shift;
Subroutine _build_path_class_typemap: called CC=1 SCAR=0.0
12  
13 17 $self->_create_typemap(
14 isa_entries => {
15 'Path::Class::Entity' => {
16 type => "KiokuDB::TypeMap::Entry::Callback",
17 intrinsic => 1,
18 collapse => "stringify",
19 expand => "new",
20 },
21 },
22 );
23 }
24  
25 sub _build_uri_typemap {
26 17 ▶ my $self = shift;
Subroutine _build_uri_typemap: called CC=1 SCAR=0.0
27  
28 17 $self->_create_typemap(
29 isa_entries => {
30 'URI' => {
31 type => "KiokuDB::TypeMap::Entry::Callback",
32 intrinsic => 1,
33 collapse => 'as_string',
34 expand => "new",
35 },
36 },
37 entries => {
38 'URI::WithBase' => {
39 type => "KiokuDB::TypeMap::Entry::Naive",
40 intrinsic => 1,
41 },
42 },
43 );
44 }
45  
46 sub _build_datetime_typemap {
47 17 ▶ my $self = shift;
Subroutine _build_datetime_typemap: called CC=1 SCAR=1.2
48  
49 $self->_create_typemap(
50 isa_entries => {
51 'DateTime' => => {
52 type => 'KiokuDB::TypeMap::Entry::Callback',
53 collapse => "epoch",
54 expand => sub {
55 0 ▶ my ( $class, $epoch ) = @_;
Subroutine __ANON__: not called CC=1 SCAR=6.9
56 0 $class->from_epoch( epoch => $epoch );
57 },
58 17 intrinsic => 1,
59 },
60 'DateTime::Duration' => => {
61 type => 'KiokuDB::TypeMap::Entry::Naive',
62 intrinsic => 1,
63 },
64 },
65 );
66 }
67  
68 sub _build_authen_passphrase_typemap {
69 17 ▶ my $self = shift;
Subroutine _build_authen_passphrase_typemap: called CC=1 SCAR=0.0
70  
71 17 $self->_create_typemap(
72 isa_entries => {
73 'Authen::Passphrase' => {
74 type => "KiokuDB::TypeMap::Entry::Callback",
75 intrinsic => 1,
76 collapse => "as_rfc2307",
77 expand => "from_rfc2307",
78 },
79 },
80 );
81 }
82  
83 7 __PACKAGE__
84  
85 __END__
86  
87 =pod
88  
89 =head1 NAME
90  
91 KiokuDB::TypeMap::Default::Canonical - A L<KiokuDB::TypeMap::Default>
92 implementation that canonicalizes the standard types to simplified versions.
93  
94 =head1 DESCRIPTION
95  
96 This typemap is suitable for serialization using L<JSON>. It stringifies or
97 otherwise converts data structures into primitive representations.
« KiokuDB/TypeMap/Entry/Std/Intrinsic.pm ↑ Summary KiokuDB/Test/Fixture/GIN/Class.pm »