| 1 | #!/usr/bin/perl | ||
| 2 | |||
| 3 | package KiokuDB::TypeMap::Entry; | ||
| 4 | 28 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 28 | ▶ | use namespace::clean -except => 'meta'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 28 | requires "compile"; | |
| 9 | |||
| 10 | 28 | __PACKAGE__ | |
| 11 | |||
| 12 | __END__ | ||
| 13 | |||
| 14 | =pod | ||
| 15 | |||
| 16 | =head1 NAME | ||
| 17 | |||
| 18 | KiokuDB::TypeMap::Entry - Role for L<KiokuDB::TypeMap> entries | ||
| 19 | |||
| 20 | =head1 SYNOPSIS | ||
| 21 | |||
| 22 | package KiokuDB::TypeMap::Foo; | ||
| 23 | use Moose; | ||
| 24 | |||
| 25 | with qw(KiokuDB::TypeMap::Entry); | ||
| 26 | |||
| 27 | # or just use KiokuDB::TypeMap::Entry::Std | ||
| 28 | |||
| 29 | sub compile { | ||
| 30 | ... | ||
| 31 | } | ||
| 32 | |||
| 33 | =head1 DESCRIPTION | ||
| 34 | |||
| 35 | This is the role consumed by all typemap entries. | ||
| 36 | |||
| 37 | =head1 REQUIRED METHODS | ||
| 38 | |||
| 39 | =over 4 | ||
| 40 | |||
| 41 | =item compile $class | ||
| 42 | |||
| 43 | This method is called by L<KiokuDB::TypeMap::Resolver> for a given class, and | ||
| 44 | should return two code references, one for collapsing and one for expanding. | ||
| 45 | |||
| 46 | The collapsing sub is called as a method on L<KiokuDB::Collapser> and the | ||
| 47 | expanding sub is called on L<KiokuDB::Linker>. | ||
| 48 | |||
| 49 | The callbacks must call other L<KiokuDB::Collapser> and L<KiokuDB::Linker> | ||
| 50 | methods to actually get the work done. | ||
| 51 | |||
| 52 | L<KiokuDB::TypeMap::Entry::Std> provides a more concise way of defining typemap entries. | ||
| 53 | |||
| 54 | =back | ||