KiokuDB/TypeMap/Default.pm

filter: Statementstmt 100% 16 / 16 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 95.4% 21 / 22 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
_build_core_typemap
1.0
CRAP 1.0
« KiokuDB/Role/Upgrade/Handlers/Table.pm ↑ Summary KiokuDB/Test/Fixture/Unicode.pm »
1 #!/usr/bin/perl
2  
3 package KiokuDB::TypeMap::Default;
4 23 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 23 ▶use namespace::clean -except => 'meta';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 23 with qw(KiokuDB::TypeMap::Composite);
9  
10 23 has intrinsic_sets => (
11 isa => "Bool",
12 is => "ro",
13 default => 0,
14 );
15  
16 23 has [qw(
17 core_typemap
18 tie_typemap
19 path_class_typemap
20 uri_typemap
21 datetime_typemap
22 authen_passphrase_typemap
23 )] => (
24 traits => [qw(KiokuDB::TypeMap)],
25 does => "KiokuDB::Role::TypeMap",
26 is => "ro",
27 lazy_build => 1,
28 );
29  
30 23 requires qw(
31 _build_path_class_typemap
32 _build_uri_typemap
33 _build_datetime_typemap
34 _build_authen_passphrase_typemap
35 );
36  
37 sub _build_core_typemap {
38 60 ▶ my $self = shift;
Subroutine _build_core_typemap: called CC=1 SCAR=0.0
39  
40 60 $self->_create_typemap(
41 entries => { $self->reftype_entries },
42 isa_entries => {
43 'KiokuDB::Set::Base' => {
44 type => "KiokuDB::TypeMap::Entry::Set",
45 intrinsic => $self->intrinsic_sets,
46 },
47 },
48 );
49 }
50  
51 sub reftype_entries {
52 return (
53 60 ▶ 'ARRAY' => "KiokuDB::TypeMap::Entry::Ref",
Subroutine reftype_entries: called CC=1 SCAR=0.0
Pod undocumented
54 'HASH' => "KiokuDB::TypeMap::Entry::Ref",
55 'SCALAR' => "KiokuDB::TypeMap::Entry::Ref",
56 'REF' => "KiokuDB::TypeMap::Entry::Ref",
57 'GLOB' => "KiokuDB::TypeMap::Entry::Ref",
58 'CODE' => "KiokuDB::TypeMap::Entry::Closure",
59 );
60 }
61  
62 sub _build_tie_typemap {
63 60 ▶ my $self = shift;
Subroutine _build_tie_typemap: called CC=1 SCAR=0.0
64  
65 60 $self->_create_typemap(
66 isa_entries => {
67 'Tie::RefHash' => {
68 type => 'KiokuDB::TypeMap::Entry::StorableHook',
69 intrinsic => 1,
70 },
71 },
72 entries => {
73 'Tie::IxHash' => {
74 type => 'KiokuDB::TypeMap::Entry::Naive',
75 intrinsic => 1,
76 },
77 },
78 );
79 }
80  
81 23 __PACKAGE__
82  
83 __END__
84  
85 =head1 NAME
86  
87 KiokuDB::TypeMap::Default - A standard L<KiokuDB::TypeMap> with predefined
88 entries.
89  
90 =head1 SYNOPSIS
91  
92 # the user typemap implicitly inherits from the default one, which is
93 # provided by the backend.
94  
95 my $dir = KiokuDB->new(
96 backend => $b,
97 typemap => $user_typemap,
98 );
99  
100 =head1 DESCRIPTION
101  
102 The default typemap is actually defined per backend, in
103 L<KiokuDB::TypeMap::Default::JSON> and L<KiokuDB::TypeMap::Default::Storable>.
104 The list of classes handled by both is the same, but the typemap entries
105 themselves are tailored to the specific backends' requirements/capabilities.
106  
107 The entries have no impact unless you are actually using the listed modules.
108  
109 The default typemap is created using L<KiokuDB::TypeMap::Composite> and accepts
110 all the standard options
111  
112 =head1 SUPPORTED TYPES
113  
114 The following typemaps provide support for these classes:
115  
116 =over 4
117  
118 =item core
119  
120 L<KiokuDB::Set>
121  
122 =item tie
123  
124 L<Tie::RefHash>, L<Tie::IxHash>
125  
126 =item datetime
127  
128 L<DateTime>
129  
130 =item uri_typemap
131  
132 L<URI>, L<URI::WithBase>
133  
134 =item path_class
135  
136 L<Path::Class::Entity>
137  
138 =item authen_passphrase
139  
140 L<Authen::Passphrase>
141  
142 =back
« KiokuDB/Role/Upgrade/Handlers/Table.pm ↑ Summary KiokuDB/Test/Fixture/Unicode.pm »