| 1 | package Crop::Refbook; | ||
| 2 | |||
| 3 | =pod | ||
| 4 | |||
| 5 | =head1 NAME | ||
| 6 | |||
| 7 | Crop::Refbook - Reference book utilities for the Crop framework | ||
| 8 | |||
| 9 | =head1 SYNOPSIS | ||
| 10 | |||
| 11 | use Crop::Refbook; | ||
| 12 | # ...usage... | ||
| 13 | |||
| 14 | =head1 DESCRIPTION | ||
| 15 | |||
| 16 | Crop::Refbook provides reference book utilities for the Crop framework. | ||
| 17 | |||
| 18 | =head1 AUTHORS | ||
| 19 | |||
| 20 | Euvgenio (Core Developer) | ||
| 21 | |||
| 22 | Alex (Contributor) | ||
| 23 | |||
| 24 | =head1 COPYRIGHT AND LICENSE | ||
| 25 | |||
| 26 | Apache 2.0 | ||
| 27 | |||
| 28 | =cut | ||
| 29 | |||
| 30 | use base qw/ Crop::Object::Simple /; | ||
| 31 | |||
| 32 | =begin nd | ||
| 33 | Class: Crop::Refbook | ||
| 34 | Global refbook. | ||
| 35 | |||
| 36 | Refbook contains a lot of global unrelated values used | ||
| 37 | arround the entire code. | ||
| 38 | =cut | ||
| 39 | |||
| 40 | use v5.14; | ||
| 41 | use warnings; | ||
| 42 | |||
| 43 | use Crop::Error; | ||
| 44 | use Crop::Util qw/ load_class /; | ||
| 45 | use Crop::Prop::Value; | ||
| 46 | use Crop::Prop::Type; | ||
| 47 | |||
| 48 | =begin nd | ||
| 49 | Variable: our %Attributes | ||
| 50 | Class attributes: | ||
| 51 | |||
| 52 | code - code to perl use | ||
| 53 | description - description | ||
| 54 | id - <Crop::Object::Simple> descendant | ||
| 55 | id_prop - appropriate <Crop::Prop> | ||
| 56 | id_val - real value | ||
| 57 | name - name | ||
| 58 | val - <Crop::Prop::Value> corresponding id_val attribute | ||
| 59 | =cut | ||
| 60 | our %Attributes = ( | ||
| 61 | code => undef, | ||
| 62 | description => undef, | ||
| 63 | id_prop => undef, | ||
| 64 | id_val => undef, | ||
| 65 | name => undef, | ||
| 66 | val => {type => 'cache'}, | ||
| 67 | ); | ||
| 68 | |||
| 69 | =begin nd | ||
| 70 | Method: is_gt ($rhs) | ||
| 71 | Is Refbook value greater than $val? | ||
| 72 | |||
| 73 | Parameters: | ||
| 74 | $rhs - RHS | ||
| 75 | |||
| 76 | Returns: | ||
| 77 | true - if Refbook is greater | ||
| 78 | false - oterhwise | ||
| 79 | =cut | ||
| 80 | sub is_gt { | ||
| 81 | my ($self, $rhs) = @_; | ||
| 82 | |||
| 83 | $self->{val} = Crop::Prop::Value->Get($self->{id}) unless $self->{val}; | ||
| 84 | |||
| 85 | my $proptype = Crop::Prop::Type->Get($self->{val}->id_proptype); | ||
| 86 | |||
| 87 | $proptype->is_gt($self->{val}, $rhs); | ||
| 88 | } | ||
| 89 | |||
| 90 | =begin nd | ||
| 91 | Method: Table ( ) | ||
| 92 | Table in the Warehouse. | ||
| 93 | |||
| 94 | Returns: | ||
| 95 | 'refbook' string | ||
| 96 | =cut | ||
| 97 | sub Table { 'refbook' } | ||
| 98 | |||
| 99 | 1; |