| 1 | package KiokuDB::Role::Upgrade::Data; | ||
| 2 | 1 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | |||
| 4 | 1 | ▶ | use namespace::clean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 1 | requires "kiokudb_upgrade_data"; | |
| 7 | |||
| 8 | # ex: set sw=4 et: | ||
| 9 | |||
| 10 | 1 | __PACKAGE__ | |
| 11 | |||
| 12 | __END__ | ||
| 13 | |||
| 14 | =pod | ||
| 15 | |||
| 16 | =head1 NAME | ||
| 17 | |||
| 18 | KiokuDB::Role::Upgrade::Data - Classes that provide their own upgrade routine. | ||
| 19 | |||
| 20 | =head1 SYNOPSIS | ||
| 21 | |||
| 22 | with qw(KiokuDB::Role::Upgrade::Data); | ||
| 23 | |||
| 24 | sub kiokudb_upgrade_data { | ||
| 25 | my ( $class, %args ) = @_; | ||
| 26 | |||
| 27 | # convert the data from the old version of the class to the new version | ||
| 28 | # as necessary | ||
| 29 | |||
| 30 | $args{entry}->derive( | ||
| 31 | class_version => our $VERSION, | ||
| 32 | ... | ||
| 33 | ); | ||
| 34 | } | ||
| 35 | |||
| 36 | =head1 DESCRIPTION | ||
| 37 | |||
| 38 | This class allows you to take control the data conversion process completely | ||
| 39 | (there is only one handler per class, not one handler per version with this | ||
| 40 | approach). | ||
| 41 | |||
| 42 | See L<KiokuDB::Role::Upgrade::Handlers::Table> for a more DWIM approach, and | ||
| 43 | L<KiokuDB::TypeMap::Entry::MOP> for more details. | ||