Crop/Object/Constants.pm untested

filter: Statementstmt 0.0% 0 / 19 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod n/a totaltotal 0.0% 0 / 25 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Crop::Object::Constants;
2 use base qw / Exporter /;
3  
4 =begin nd
5 Class: Crop::Object::Constants
6 ORM constants.
7  
8 Constants are used in several files such <Crop::Object> and <Crop::Object::Collection> so are located
9 in separate file.
10 =cut
11  
12 use v5.14;
13 use warnings;
14  
15 =begin nd
16 Variable: our @EXPORT
17 All the constants are exported by default.
18
19 DONT_SYNC
20
21 REMOVED NOSYNC DWHLINK MODIFIED OBJINIT DOSYNC
22
23 ANY CACHED STORED KEY
24 =cut
25 our @EXPORT = qw/
26 DONT_SYNC
27 REMOVED NOSYNC DWHLINK MODIFIED OBJINIT DOSYNC
28 ANY CACHED STORED KEY
29 /;
30  
31 =begin nd
32 Constant: DONT_SYNC
33 Do not synchronyze the Object with database state.
34  
35 Constructor has form of:
36 > My::Class->new(DONT_SYNC, a1=>v1, ...)
37 =cut
38 use constant {
39 DONT_SYNC => '__DONT_SYNC__',
40 };
41  
42 =begin nd
43 Constants:
44 Inner state flags located in $self->{STATE}
45  
46 Constant: REMOVED
47 Object will be removed from database.
48
49 Constant: NOSYNC
50 The object has unsaved changes. See <DONT_SYNC>.
51
52 Constant: DWHLINK
53 Object has been loaded from warehouse.
54
55 Constant: MODIFIED
56 Object is modified after it has been loaded from warehouse. It is significant only if the <DWHLINK> flag is up.
57
58 Constant: OBJINIT
59 The binary mask to setup all the flag at init state.
60
61 Constant: DOSYNC
62 Binary mask for make down the <NO_SYNC> flag.
63 =cut
64 use constant {
65 REMOVED => 0b0001,
66 NOSYNC => 0b0010,
67 DWHLINK => 0b0100,
68 MODIFIED => 0b1000,
69  
70 OBJINIT => 0b0000,
71 DOSYNC => 0b1101,
72 };
73  
74 =begin nd
75 Constants:
76 Attribute could be saved in a warehouse
77  
78 Constant: ANY
79 Any of both types
80  
81 Constant: CACHED
82 Attribute will not be saved in a warehouse
83  
84 Constant: STORED
85 Attribute will be saved in a warehouse
86
87 Constant: KEY
88 Attribute will be saved in database and it is a primary key
89 =cut
90 use constant {
91 ANY => 0,
92 CACHED => 1,
93 STORED => 2,
94 KEY => 3,
95 };
96  
97 1;