lib/Badger/Constants.pm

filter: Statementstmt 100% 16 / 16 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 100% 20 / 20 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« lib/Badger/Codec/Timestamp.pm ↑ Summary lib/Badger/Data/Facet/List.pm »
1 #========================================================================
2 #
3 # Badger::Constants
4 #
5 # DESCRIPTION
6 # Defines various constants used by the Badger modules
7 #
8 # AUTHOR
9 # Andy Wardley <abw@wardley.org>
10 #
11 #========================================================================
12  
13 package Badger::Constants;
14  
15 70 our $VERSION = 0.01;
16  
17 70 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 70 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 70 ▶use base 'Badger::Exporter';
Subroutine BEGIN: called CC=1 SCAR=0.0
20 use constant {
21 # this is me
22 70 CONSTANTS => __PACKAGE__,
23
24 # various type classes
25 SCALAR => 'SCALAR',
26 ARRAY => 'ARRAY',
27 HASH => 'HASH',
28 CODE => 'CODE',
29 GLOB => 'GLOB',
30 REGEX => 'Regexp',
31
32 # constant values
33 FALSE => 0,
34 TRUE => 1,
35 OFF => 0,
36 ON => 1,
37 ALL => 'all',
38 NONE => 'none',
39 DEFAULT => 'default',
40
41 # misc constants used internally
42 FIRST => 0, # first and last items in a list
43 LAST => -1,
44 CRLF => "\015\012", # unambiguous CR+LF sequence
45 PKG => '::', # for joining pkg names
46 DOT => '.', # for joining dotty names
47 REFS => 'refs', # no strict REFS
48 ONCE => 'once', # use warnings ONCE
49 WARN => 'warn', # default warning handler
50 BLANK => '', # how much more blank could this be?
51 SPACE => ' ', # and the answer is none, none more blank
52 SLASH => '/', # URI path delimiter
53 DELIMITER => qr/(?:,\s*)|\s+/, # match a comma or whitespace
54 WILDCARD => qr/[\*\?]/, # wildcards: *.html foo??.txt
55 LOADED => 'BADGER_LOADED', # set by Badger::Class on autoload
56 UTF8 => 'utf8',
57 YAML => 'yaml',
58 JSON => 'json',
59 70 ▶};
Subroutine BEGIN: called CC=1 SCAR=0.0
60  
61 70 CONSTANTS->export_any(qw(
62 CONSTANTS FIRST LAST CRLF PKG DOT REFS ONCE WARN BLANK SPACE SLASH
63 DELIMITER WILDCARD LOADED UTF8 YAML JSON
64 ));
65  
66 70 CONSTANTS->export_tags({
67 types => [qw(
68 SCALAR ARRAY HASH CODE GLOB REGEX
69 )],
70 values => [qw(
71 FALSE TRUE OFF ON ALL NONE DEFAULT
72 )],
73 });
74  
75 70 1;
76  
77 __END__
« lib/Badger/Codec/Timestamp.pm ↑ Summary lib/Badger/Data/Facet/List.pm »