File Coverage

blib/lib/XAS/Constants.pm
Criterion Covered Total %
statement 6 6 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 8 8 100.0


line stmt bran cond sub pod time code
1             package XAS::Constants;
2              
3             our $VERSION = '0.04';
4              
5 1     1   1000 use Params::Validate qw(ARRAYREF HASHREF CODEREF SCALARREF BOOLEAN HANDLE);
  1         1  
  1         466  
6              
7             use Badger::Class
8 1         39 debug => 0,
9             version => $VERSION,
10             base => 'Badger::Constants', # grab the badger constants
11             constant => {
12              
13             # generic
14              
15             LF => "\012",
16             CR => "\015",
17              
18             # JSON RPC
19              
20             RPC_JSON => '2.0',
21             RPC_DEFAULT_ADDRESS => '127.0.0.1',
22             RPC_DEFAULT_PORT => '9505',
23             RPC_ERR_PARSE => -32700,
24             RPC_ERR_REQ => -32600,
25             RPC_ERR_METHOD => -32601,
26             RPC_ERR_PARAMS => -32602,
27             RPC_ERR_INTERNAL => -32603,
28             RPC_ERR_SERVER => -32099,
29             RPC_ERR_APP => -32001,
30             RPC_SRV_ERR_MIN => -32000,
31             RPC_SRV_ERR_MAX => -32768,
32              
33             # process states
34              
35             PROC_STARTED => 0,
36             PROC_RUNNING => 1,
37             PROC_STOPPED => 2,
38             PROC_PAUSED => 3,
39             PROC_SHUTDOWN => 4,
40             PROC_KILLED => 5,
41              
42             # logging
43              
44             LOG_LEVELS => qr/info|warn|error|fatal|debug|trace/,
45             LOG_TYPES => qr/console|file|json|syslog/,
46             LOG_FACILITY => qr/auth|authpriv|cron|daemon|ftp|local[0-7]|lpr|mail|news|user|uucp/,
47              
48             # alerts
49              
50             ALERT_PRIORITY => qr/low|medium|high|info/i,
51             ALERT_FACILITY => qr/systems/i,
52              
53             # stomp
54              
55             STOMP_EOF => "\000",
56             STOMP_LEVELS => qr/1\.[0-2]/,
57             STOMP_CNTRL => qr((?:[[:cntrl:]])+),
58             STOMP_HEADER => qr(([\w\-~]+)\s*:\s*(.*)),
59             STOMP_EOL => qr((\015\012?|\012\015?|\015|\012)),
60             STOMP_BEOH => qr((\015\012\000?|\012\015\000?|\015\000|\012\000)),
61             STOMP_EOH => qr((\015\012\015\012?|\012\015\012\015?|\015\015|\012\012)),
62              
63             # lockmgr
64              
65             LOCK_DRIVERS => qr(Flom|Filesystem|Nolock|KeyedMutex),
66              
67             },
68             exports => {
69             all => 'RPC_JSON RPC_DEFAULT_PORT RPC_DEFAULT_ADDRESS RPC_ERR_PARSE
70             RPC_ERR_REQ RPC_ERR_METHOD RPC_ERR_PARAMS RPC_ERR_INTERNAL
71             RPC_ERR_SERVER RPC_SRV_ERR_MAX RPC_SRV_ERR_MIN
72             RPC_ERR_APP LOG_LEVELS LOG_TYPES LOG_FACILITY
73             ALERT_PRIORITY ALERT_FACILITY STOMP_LEVELS STOMP_EOF
74             STOMP_CNTRL STOMP_HEADER STOMP_EOL STOMP_BEOH STOMP_EOH LF CR
75             PROC_STARTED PROC_RUNNING PROC_STOPPED PROC_PAUSED PROC_SHUTDOWN
76             PROC_KILLED LOCK_DRIVERS
77             ARRAYREF HASHREF CODEREF SCARLARREF BOOLEAN HANDLE',
78             any => 'RPC_JSON RPC_DEFAULT_PORT RPC_DEFAULT_ADDRESS RPC_ERR_PARSE
79             RPC_ERR_REQ RPC_ERR_METHOD RPC_ERR_PARAMS RPC_ERR_INTERNAL
80             RPC_ERR_SERVER RPC_SRV_ERR_MAX RPC_SRV_ERR_MIN
81             RPC_ERR_APP LOG_LEVELS LOG_TYPES LOG_FACILITY ALERT_PRIORITY
82             ALERT_FACILITY STOMP_LEVELS STOMP_EOF STOMP_CNTRL STOMP_HEADER
83             STOMP_EOL STOMP_BEOH STOMP_EOH LF CR
84             PROC_STARTED PROC_RUNNING PROC_STOPPED PROC_PAUSED PROC_SHUTDOWN
85             PROC_KILLED LOCK_DRIVERS
86             ARRAYREF HASHREF CODEREF SCARLARREF BOOLEAN HANDLE ',
87             tags => {
88             jsonrpc => 'RPC_JSON RPC_DEFAULT_PORT RPC_DEFAULT_ADDRESS RPC_ERR_PARSE
89             RPC_ERR_REQ RPC_ERR_METHOD RPC_ERR_PARAMS RPC_ERR_INTERNAL
90             RPC_ERR_SERVER RPC_SRV_ERR_MAX RPC_SRV_ERR_MIN RPC_ERR_APP',
91             locking => 'LOCK_DRIVERS',
92             logging => 'LOG_LEVELS LOG_TYPES LOG_FACILITY',
93             alerts => 'ALERT_PRIORITY ALERT_FACILITY',
94             stomp => 'STOMP_LEVELS STOMP_EOF STOMP_CNTRL STOMP_HEADER
95             STOMP_EOL STOMP_BEOH STOMP_EOH',
96             process => 'PROC_STARTED PROC_RUNNING PROC_STOPPED PROC_PAUSED
97             PROC_SHUTDOWN PROC_KILLED',
98             validate => 'ARRAYREF HASHREF CODEREF SCARLARREF BOOLEAN HANDLE',
99             }
100             }
101 1     1   5 ;
  1         1  
102              
103             1;
104              
105             __END__
106              
107             =head1 NAME
108              
109             XAS::Constants - A Perl extension for the XAS environment
110              
111             =head1 SYNOPSIS
112              
113             use XAS::Class
114             base => 'XAS::Base',
115             constant => 'TRUE FALSE'
116             ;
117              
118             ... or ...
119              
120             use XAS::Constants 'TRUE FALSE';
121              
122             =head1 DESCRIPTION
123              
124             This module provides various constants for the XAS enviromnet. It inherits from
125             L<Badger::Constants|https://metacpan.org/pod/Badger::Constants> and also provides these additional
126             constants.
127              
128             =head2 EXPORT
129              
130             RPC_JSON RPC_DEFAULT_PORT RPC_DEFAULT_ADDRESS RPC_ERR_PARSE
131             RPC_ERR_REQ RPC_ERR_METHOD RPC_ERR_PARAMS RPC_ERR_INTERNAL
132             RPC_ERR_SERVER RPC_SRV_ERR_MAX RPC_SRV_ERR_MIN RPC_ERR_APP
133              
134             LOG_TYPES LOG_FACILITY LOG_LEVELS
135              
136             ALERT_PRIORITY ALERT_FACILITY
137            
138             STOMP_LEVELS STOMP_EOF STOMP_CNTRL STOMP_HEADER STOMP_EOL
139             STOMP_BEOH STOMP_EOH
140              
141             PROC_STARTED PROC_RUNNING PROC_STOPPED PROC_PAUSED PROC_SHUTDOWN PROC_KILLED
142              
143             LOCK_DRIVERS
144              
145             CR LF
146              
147             Along with these tags
148              
149             jsonrpc
150             logging
151             alerts
152             stomp
153             locking
154             process
155              
156             =head1 SEE ALSO
157              
158             =over 4
159              
160             =item L<XAS|XAS>
161              
162             =back
163              
164             =head1 AUTHOR
165              
166             Kevin Esteb, E<lt>kevin@kesteb.usE<gt>
167              
168             =head1 COPYRIGHT AND LICENSE
169              
170             Copyright (c) 2012-2015 Kevin L. Esteb
171              
172             This is free software; you can redistribute it and/or modify it under
173             the terms of the Artistic License 2.0. For details, see the full text
174             of the license at http://www.perlfoundation.org/artistic_license_2_0.
175              
176             =cut