File Coverage

lib/Badger/Constants.pm
Criterion Covered Total %
statement 12 12 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 16 16 100.0


line stmt bran cond sub pod time code
1             #========================================================================
2             #
3             # Badger::Constants
4             #
5             # DESCRIPTION
6             # Defines various constants used by the Badger modules
7             #
8             # AUTHOR
9             # Andy Wardley
10             #
11             #========================================================================
12              
13             package Badger::Constants;
14              
15             our $VERSION = 0.01;
16              
17 70     70   1885 use strict;
  70         106  
  70         1822  
18 70     70   268 use warnings;
  70         1440  
  70         1695  
19 70     70   280 use base 'Badger::Exporter';
  70         1452  
  70         15476  
20             use constant {
21             # this is me
22 70         35635 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     70   460 };
  70         95  
60              
61             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             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             1;
76              
77             __END__