« Crop/Object/Extern/Refbook.pm
↑ Summary
Crop/Object/Warehouse/Lang/SQL/Query/Select/Node/Bundle.pm »
| 1 | package Crop::Object::Key; | ||
| 2 | use base qw/ Crop /; | ||
| 3 | |||
| 4 | =begin nd | ||
| 5 | Class: Crop::Object::Key | ||
| 6 | Key of an Object. | ||
| 7 | |||
| 8 | This module not inherit <Crop::Object>, so automatic generation of getters/setters missed. | ||
| 9 | |||
| 10 | <my %Attibutes> are default values each item has. | ||
| 11 | =cut | ||
| 12 | |||
| 13 | use v5.14; | ||
| 14 | use warnings; | ||
| 15 | |||
| 16 | =begin nd | ||
| 17 | Variable: my %Attributes | ||
| 18 | Attributes: | ||
| 19 | |||
| 20 | type - 'counter' for Sequence.n, 'ordinal' for Simple, 'extern' for Sequence exernal id | ||
| 21 | =cut | ||
| 22 | my %Attributes = ( | ||
| 23 | type => undef, | ||
| 24 | ); | ||
| 25 | |||
| 26 | =begin nd | ||
| 27 | Constructor: new (%in) | ||
| 28 | Set the type of key. | ||
| 29 | |||
| 30 | Parameters: | ||
| 31 | %in - one item 'type' has predefined vaule | ||
| 32 | |||
| 33 | Returns: | ||
| 34 | $self | ||
| 35 | =cut | ||
| 36 | sub new { | ||
| 37 | my ($class, %in) = @_; | ||
| 38 | |||
| 39 | my $self = bless { | ||
| 40 | %Attributes, | ||
| 41 | %in, | ||
| 42 | }, $class; | ||
| 43 | } | ||
| 44 | |||
| 45 | =begin nd | ||
| 46 | Method: type ( ) | ||
| 47 | Getter. | ||
| 48 | |||
| 49 | Returns: | ||
| 50 | type of key | ||
| 51 | =cut | ||
| 52 | sub type { shift->{type} } | ||
| 53 | |||
| 54 | 1; |