Crop/Prop/Type.pm untested

filter: Statementstmt 0.0% 0 / 28 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 5 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 51 CC 3 SCAR 16.1
CC
3
Cov
0%
new
12.0
is_gt
2.0
Table
2.0
CRAP 5.0
1 package Crop::Prop::Type;
2 use base qw/ Crop::Object::Simple /;
3  
4 =begin nd
5 Class: Crop::Prop::Type
6 Property type.
7
8 Abstract class.
9 =cut
10  
11 use v5.14;
12 use warnings;
13  
14 use Crop::Error;
15 use Crop::Util qw/ expose_hashes load_class /;
16  
17 =begin nd
18 Variable: our %Attributes
19 Class attributes:
20  
21 code - reference to subclass
22 description - description
23 id - from <Crop::Object::Simple>
24 name - name
25 =cut
26 our %Attributes = (
27 code => {mode => 'read'},
28 description => undef,
29 name => undef,
30 );
31  
32 =begin nd
33 Constructor: new (@attr)
34 Fabrica of subclasses.
35
36 Based on code.
37
38 Parameters:
39 @attr - attributes
40
41 Returns:
42 $self - on success
43 undef - error
44 =cut
45 sub new {
46 my ($class, @attr) = @_;
47 my $attr = expose_hashes \@attr;
48
49 if ($class eq __PACKAGE__) {
50 return warn "OBJECT|CRIT: " . __PACKAGE__ . ' cannot init without the code attribute' unless exists $attr->{code};
51
52 my $worker = __PACKAGE__ . "::$attr->{code}";
53 load_class $worker or return warn "Cannot init Property Type as $worker failure";
54
55 $worker->new(@attr);
56 } else {
57 $class->SUPER::new(@attr);
58 }
59 }
60  
61 =begin nd
62 Method: is_gt ($val, $rhs)
63 Is greater $val over $rhs?
64
65 Pure virtual.
66
67 Parameters:
68 $val - LHS of <Crop:Prop::Value>
69 $rhs - RHS in bytes
70
71 Returns:
72 error
73 =cut
74 sub is_gt {
75 my $either = shift;
76 my $class = ref $either // $either;
77
78 warn "OBJECT|CRIT: Method is_gt() must be redefined by subclass $class";
79 }
80  
81 =begin nd
82 Method: Table ( )
83 Table in the Warehouse.
84  
85 Returns:
86 'proptype' string
87 =cut
88 sub Table { 'proptype' }
89  
90 1;