KiokuDB/Role/Upgrade/Handlers/Table.pm

filter: Statementstmt 100% 16 / 16 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 95.2% 20 / 21 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« KiokuDB/Class.pm ↑ Summary KiokuDB/TypeMap/Default.pm »
1 package KiokuDB::Role::Upgrade::Handlers::Table;
2 2 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 2 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 with qw(KiokuDB::Role::Upgrade::Handlers);
7  
8 2 requires "kiokudb_upgrade_handlers_table";
9  
10 2 ▶no warnings 'uninitialized';
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 sub kiokudb_upgrade_handler {
13 21 ▶ my ( $class, $version ) = @_;
Subroutine kiokudb_upgrade_handler: called CC=1 SCAR=0.0
Pod undocumented
14  
15 21 my $table = $class->kiokudb_upgrade_handlers_table;
16  
17 21 return grep { defined } $table->{$version};
18 }
19  
20 # ex: set sw=4 et:
21  
22 2 __PACKAGE__
23  
24 __END__
25  
26 =pod
27  
28 =head1 NAME
29  
30 KiokuDB::Role::Upgrade::Handlers::Table - A role for classes
31  
32 =head1 SYNOPSIS
33  
34 with qw(KiokuDB::Role::Upgrade::Handlers::Table);
35  
36 use constant kiokudb_upgrade_handlers_table => {
37  
38 # like the individual entries in class_version_table
39  
40 "0.01" => "0.02",
41 "0.02" => sub {
42 ...
43 },
44 };
45  
46 =head1 DESCRIPTION
47  
48 This class lets you provide the version handling table as part of the class
49 definition, instead of as arguments to the L<KiokuDB> handle constructor.
50  
51 See L<KiokuDB::TypeMap::Entry::MOP> more details and
52 L<KiokuDB::Role::Upgrade::Data> for a lower level alternative.
« KiokuDB/Class.pm ↑ Summary KiokuDB/TypeMap/Default.pm »