Simple/Constants.pm

filter: Statementstmt 100% 353 / 353 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 117 / 117 Podpod n/a totaltotal 100% 470 / 470 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Simple/Compiler.pm ↑ Summary
1 package Text::Template::Simple::Constants;
2 45 $Text::Template::Simple::Constants::VERSION = '0.91';
3 45 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 45 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 45 my($FIELD_ID);
7  
8 45 ▶use constant RESET_FIELD => -1;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 # object fields
11 45 ▶BEGIN { $FIELD_ID = RESET_FIELD } # init object field id counter
Subroutine BEGIN: called CC=1 SCAR=0.0
12 45 ▶use constant DELIMITERS => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 45 ▶use constant AS_STRING => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 45 ▶use constant DELETE_WS => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 45 ▶use constant FAKER => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 45 ▶use constant FAKER_HASH => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 45 ▶use constant FAKER_SELF => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 45 ▶use constant FAKER_WARN => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 45 ▶use constant MONOLITH => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 45 ▶use constant CACHE => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 45 ▶use constant CACHE_DIR => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 45 ▶use constant CACHE_OBJECT => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 45 ▶use constant IO_OBJECT => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
24 45 ▶use constant STRICT => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 45 ▶use constant SAFE => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
26 45 ▶use constant HEADER => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 45 ▶use constant ADD_ARGS => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
28 45 ▶use constant CAPTURE_WARNINGS => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 45 ▶use constant WARN_IDS => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
30 45 ▶use constant TYPE => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 45 ▶use constant TYPE_FILE => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
32 45 ▶use constant COUNTER => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
33 45 ▶use constant COUNTER_INCLUDE => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
34 45 ▶use constant INSIDE_INCLUDE => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
35 45 ▶use constant NEEDS_OBJECT => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
36 45 ▶use constant CID => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
37 45 ▶use constant FILENAME => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
38 45 ▶use constant IOLAYER => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
39 45 ▶use constant STACK => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
40 45 ▶use constant USER_THANDLER => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
41 45 ▶use constant DEEP_RECURSION => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
42 45 ▶use constant INCLUDE_PATHS => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
43 45 ▶use constant PRE_CHOMP => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
44 45 ▶use constant POST_CHOMP => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
45 45 ▶use constant VERBOSE_ERRORS => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
46 45 ▶use constant TAINT_MODE => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
47 45 ▶use constant MAXOBJFIELD => $FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
48  
49 # token type ids
50 45 ▶BEGIN { $FIELD_ID = 0 }
Subroutine BEGIN: called CC=1 SCAR=0.0
51 45 ▶use constant T_DELIMSTART => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
52 45 ▶use constant T_DELIMEND => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
53 45 ▶use constant T_DISCARD => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
54 45 ▶use constant T_COMMENT => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
55 45 ▶use constant T_RAW => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
56 45 ▶use constant T_NOTADELIM => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
57 45 ▶use constant T_CODE => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
58 45 ▶use constant T_CAPTURE => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
59 45 ▶use constant T_DYNAMIC => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
60 45 ▶use constant T_STATIC => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
61 45 ▶use constant T_MAPKEY => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
62 45 ▶use constant T_COMMAND => ++$FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
63 45 ▶use constant T_MAXID => $FIELD_ID;
Subroutine BEGIN: called CC=1 SCAR=0.0
64  
65 # settings
66 45 ▶use constant MAX_RECURSION => 50; # recursion limit for dynamic includes
Subroutine BEGIN: called CC=1 SCAR=0.0
67 45 ▶use constant PARENT => ( __PACKAGE__ =~ m{ (.+?) ::Constants }xms );
Subroutine BEGIN: called CC=1 SCAR=0.0
68 45 ▶use constant IS_WINDOWS => $^O eq 'MSWin32';
Subroutine BEGIN: called CC=1 SCAR=0.0
69 45 ▶use constant DELIM_START => 0; # field id
Subroutine BEGIN: called CC=1 SCAR=0.0
70 45 ▶use constant DELIM_END => 1; # field id
Subroutine BEGIN: called CC=1 SCAR=0.0
71 45 ▶use constant RE_NONFILE => qr{ [ \n \r < > * ? ] }xmso;
Subroutine BEGIN: called CC=1 SCAR=0.0
72 45 ▶use constant RE_DUMP_ERROR => qr{
Subroutine BEGIN: called CC=1 SCAR=0.0
73 \QCan't locate object method "first" via package "B::SVOP"\E
74 45 }xms;
75 45 ▶use constant COMPILER => PARENT . '::Compiler';
Subroutine BEGIN: called CC=1 SCAR=0.0
76 45 ▶use constant COMPILER_SAFE => COMPILER . '::Safe';
Subroutine BEGIN: called CC=1 SCAR=0.0
77 45 ▶use constant DUMMY_CLASS => PARENT . '::Dummy';
Subroutine BEGIN: called CC=1 SCAR=0.0
78 45 ▶use constant MAX_FILENAME_LENGTH => 120;
Subroutine BEGIN: called CC=1 SCAR=0.0
79 45 ▶use constant CACHE_EXT => '.tts.cache';
Subroutine BEGIN: called CC=1 SCAR=0.0
80 45 ▶use constant STAT_SIZE => 7;
Subroutine BEGIN: called CC=1 SCAR=0.0
81 45 ▶use constant STAT_MTIME => 9;
Subroutine BEGIN: called CC=1 SCAR=0.0
82 45 ▶use constant DELIMS => qw( <% %> );
Subroutine BEGIN: called CC=1 SCAR=0.0
83 45 ▶use constant UNICODE_PERL => $] >= 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
84  
85 45 ▶use constant CHOMP_NONE => 0x000000;
Subroutine BEGIN: called CC=1 SCAR=0.0
86 45 ▶use constant COLLAPSE_NONE => 0x000000;
Subroutine BEGIN: called CC=1 SCAR=0.0
87 45 ▶use constant CHOMP_ALL => 0x000002;
Subroutine BEGIN: called CC=1 SCAR=0.0
88 45 ▶use constant CHOMP_LEFT => 0x000004;
Subroutine BEGIN: called CC=1 SCAR=0.0
89 45 ▶use constant CHOMP_RIGHT => 0x000008;
Subroutine BEGIN: called CC=1 SCAR=0.0
90 45 ▶use constant COLLAPSE_LEFT => 0x000010;
Subroutine BEGIN: called CC=1 SCAR=0.0
91 45 ▶use constant COLLAPSE_RIGHT => 0x000020;
Subroutine BEGIN: called CC=1 SCAR=0.0
92 45 ▶use constant COLLAPSE_ALL => 0x000040;
Subroutine BEGIN: called CC=1 SCAR=0.0
93  
94 45 ▶use constant TAINT_CHECK_NORMAL => 0x000000;
Subroutine BEGIN: called CC=1 SCAR=0.0
95 45 ▶use constant TAINT_CHECK_ALL => 0x000002;
Subroutine BEGIN: called CC=1 SCAR=0.0
96 45 ▶use constant TAINT_CHECK_WINDOWS => 0x000004;
Subroutine BEGIN: called CC=1 SCAR=0.0
97 45 ▶use constant TAINT_CHECK_FH_READ => 0x000008;
Subroutine BEGIN: called CC=1 SCAR=0.0
98  
99 # first level directives
100 45 ▶use constant DIR_CAPTURE => q{=};
Subroutine BEGIN: called CC=1 SCAR=0.0
101 45 ▶use constant DIR_DYNAMIC => q{*};
Subroutine BEGIN: called CC=1 SCAR=0.0
102 45 ▶use constant DIR_STATIC => q{+};
Subroutine BEGIN: called CC=1 SCAR=0.0
103 45 ▶use constant DIR_NOTADELIM => q{!};
Subroutine BEGIN: called CC=1 SCAR=0.0
104 45 ▶use constant DIR_COMMENT => q{#};
Subroutine BEGIN: called CC=1 SCAR=0.0
105 45 ▶use constant DIR_COMMAND => q{|};
Subroutine BEGIN: called CC=1 SCAR=0.0
106 # second level directives
107 45 ▶use constant DIR_CHOMP => q{-};
Subroutine BEGIN: called CC=1 SCAR=0.0
108 45 ▶use constant DIR_COLLAPSE => q{~};
Subroutine BEGIN: called CC=1 SCAR=0.0
109 45 ▶use constant DIR_CHOMP_NONE => q{^};
Subroutine BEGIN: called CC=1 SCAR=0.0
110  
111 # token related indexes
112 45 ▶use constant TOKEN_STR => 0;
Subroutine BEGIN: called CC=1 SCAR=0.0
113 45 ▶use constant TOKEN_ID => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
114 45 ▶use constant TOKEN_CHOMP => 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
115 45 ▶use constant TOKEN_TRIGGER => 3;
Subroutine BEGIN: called CC=1 SCAR=0.0
116  
117 45 ▶use constant TOKEN_CHOMP_NEXT => 0; # sub-key for TOKEN_CHOMP
Subroutine BEGIN: called CC=1 SCAR=0.0
118 45 ▶use constant TOKEN_CHOMP_PREV => 1; # sub-key for TOKEN_CHOMP
Subroutine BEGIN: called CC=1 SCAR=0.0
119  
120 45 ▶use constant LAST_TOKEN => -1;
Subroutine BEGIN: called CC=1 SCAR=0.0
121 45 ▶use constant PREVIOUS_TOKEN => -2;
Subroutine BEGIN: called CC=1 SCAR=0.0
122  
123 45 ▶use constant CACHE_PARENT => 0; # object id
Subroutine BEGIN: called CC=1 SCAR=0.0
124 45 ▶use constant CACHE_FMODE => 0600;
Subroutine BEGIN: called CC=1 SCAR=0.0
125  
126 45 ▶use constant EMPTY_STRING => q{};
Subroutine BEGIN: called CC=1 SCAR=0.0
127  
128 45 ▶use constant FMODE_GO_WRITABLE => 022;
Subroutine BEGIN: called CC=1 SCAR=0.0
129 45 ▶use constant FMODE_GO_READABLE => 066;
Subroutine BEGIN: called CC=1 SCAR=0.0
130 45 ▶use constant FTYPE_MASK => 07777;
Subroutine BEGIN: called CC=1 SCAR=0.0
131  
132 45 ▶use constant MAX_PATH_LENGTH => 255;
Subroutine BEGIN: called CC=1 SCAR=0.0
133 45 ▶use constant DEVEL_SIZE_VERSION => 0.72;
Subroutine BEGIN: called CC=1 SCAR=0.0
134  
135 45 ▶use constant DEBUG_LEVEL_NORMAL => 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
136 45 ▶use constant DEBUG_LEVEL_VERBOSE => 2;
Subroutine BEGIN: called CC=1 SCAR=0.0
137 45 ▶use constant DEBUG_LEVEL_INSANE => 3;
Subroutine BEGIN: called CC=1 SCAR=0.0
138  
139  
140 # SHA seems to be more accurate, so we'll try them first.
141 # Pure-Perl ones are slower, but they are fail-safes.
142 # However, Digest::SHA::PurePerl does not work under $perl < 5.6.
143 # But, Digest::Perl::MD5 seems to work under older perls (5.5.4 at least).
144 45 ▶use constant DIGEST_MODS => qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
145 Digest::SHA
146 Digest::SHA1
147 Digest::SHA2
148 Digest::SHA::PurePerl
149 Digest::MD5
150 MD5
151 Digest::Perl::MD5
152 45 );
153  
154 45 ▶use constant RE_PIPE_SPLIT => qr/ [|] (?:\s+)? (NAME|PARAM|FILTER|SHARE) : /xms;
Subroutine BEGIN: called CC=1 SCAR=0.0
155 45 ▶use constant RE_FILTER_SPLIT => qr/ \, (?:\s+)? /xms;
Subroutine BEGIN: called CC=1 SCAR=0.0
156 45 ▶use constant RE_INVALID_CID =>
Subroutine BEGIN: called CC=1 SCAR=0.0
157 45 qr{[^A-Za-z_0-9]}xms; ## no critic (ProhibitEnumeratedClasses)
158  
159 45 ▶use constant DISK_CACHE_MARKER => q{# This file is automatically generated by }
Subroutine BEGIN: called CC=1 SCAR=0.0
160 . PARENT
161 45 ;
162  
163 45 ▶use base qw( Exporter );
Subroutine BEGIN: called CC=1 SCAR=0.0
164  
165 45 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
166  
167 45 our %EXPORT_TAGS = (
168 info => [qw(
169 UNICODE_PERL
170 IS_WINDOWS
171 COMPILER
172 COMPILER_SAFE
173 DUMMY_CLASS
174 MAX_FILENAME_LENGTH
175 CACHE_EXT
176 PARENT
177 )],
178 templates => [qw(
179 DISK_CACHE_MARKER
180 )],
181 delims => [qw(
182 DELIM_START
183 DELIM_END
184 DELIMS
185 )],
186 fields => [qw(
187 DELIMITERS
188 AS_STRING
189 DELETE_WS
190 FAKER
191 FAKER_HASH
192 FAKER_SELF
193 FAKER_WARN
194 CACHE
195 CACHE_DIR
196 CACHE_OBJECT
197 MONOLITH
198 IO_OBJECT
199 STRICT
200 SAFE
201 HEADER
202 ADD_ARGS
203 WARN_IDS
204 CAPTURE_WARNINGS
205 TYPE
206 TYPE_FILE
207 COUNTER
208 COUNTER_INCLUDE
209 INSIDE_INCLUDE
210 NEEDS_OBJECT
211 CID
212 FILENAME
213 IOLAYER
214 STACK
215 USER_THANDLER
216 DEEP_RECURSION
217 INCLUDE_PATHS
218 PRE_CHOMP
219 POST_CHOMP
220 VERBOSE_ERRORS
221 TAINT_MODE
222 MAXOBJFIELD
223 )],
224 chomp => [qw(
225 CHOMP_NONE
226 COLLAPSE_NONE
227 CHOMP_ALL
228 CHOMP_LEFT
229 CHOMP_RIGHT
230 COLLAPSE_LEFT
231 COLLAPSE_RIGHT
232 COLLAPSE_ALL
233 )],
234 directive => [qw(
235 DIR_CHOMP
236 DIR_COLLAPSE
237 DIR_CHOMP_NONE
238 DIR_CAPTURE
239 DIR_DYNAMIC
240 DIR_STATIC
241 DIR_NOTADELIM
242 DIR_COMMENT
243 DIR_COMMAND
244 )],
245 token => [qw(
246 TOKEN_ID
247 TOKEN_STR
248 TOKEN_CHOMP
249 TOKEN_TRIGGER
250 TOKEN_CHOMP_NEXT
251 TOKEN_CHOMP_PREV
252 LAST_TOKEN
253 PREVIOUS_TOKEN
254  
255 T_DELIMSTART
256 T_DELIMEND
257 T_DISCARD
258 T_COMMENT
259 T_RAW
260 T_NOTADELIM
261 T_CODE
262 T_CAPTURE
263 T_DYNAMIC
264 T_STATIC
265 T_MAPKEY
266 T_COMMAND
267 T_MAXID
268 )],
269 taint => [qw(
270 TAINT_CHECK_NORMAL
271 TAINT_CHECK_ALL
272 TAINT_CHECK_WINDOWS
273 TAINT_CHECK_FH_READ
274 )],
275 etc => [qw(
276 DIGEST_MODS
277 STAT_MTIME
278 RE_DUMP_ERROR
279 RE_PIPE_SPLIT
280 RE_FILTER_SPLIT
281 RE_NONFILE
282 RE_INVALID_CID
283 STAT_SIZE
284 MAX_RECURSION
285 CACHE_FMODE
286 CACHE_PARENT
287 RESET_FIELD
288 EMPTY_STRING
289 MAX_PATH_LENGTH
290 DEVEL_SIZE_VERSION
291 )],
292 fmode => [qw(
293 FMODE_GO_WRITABLE
294 FMODE_GO_READABLE
295 FTYPE_MASK
296 )],
297 debug => [qw(
298 DEBUG_LEVEL_NORMAL
299 DEBUG_LEVEL_VERBOSE
300 DEBUG_LEVEL_INSANE
301 )],
302 );
303  
304 45 our @EXPORT_OK = map { @{ $EXPORT_TAGS{$_} } } keys %EXPORT_TAGS;
305 45 our @EXPORT = @EXPORT_OK;
306 45 $EXPORT_TAGS{all} = \@EXPORT_OK;
307 }
308  
309 45 1;
310  
311 __END__
« Simple/Compiler.pm ↑ Summary