| 1 | package XAS::Constants; | ||
| 2 | |||
| 3 | 1 | our $VERSION = '0.02'; | |
| 4 | |||
| 5 | 1 | ▶ | use Badger::Exporter; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | use Badger::Class | ||
| 8 | 1 | debug => 0, | |
| 9 | version => $VERSION, | ||
| 10 | base => 'Badger::Constants', # grab the badger constants | ||
| 11 | constant => { | ||
| 12 | XAS_QUEUE => '/queue/xas', | ||
| 13 | |||
| 14 | # Supervisor | ||
| 15 | |||
| 16 | START => 'start', | ||
| 17 | STOP => 'stop', | ||
| 18 | EXIT => 'exit', | ||
| 19 | RELOAD => 'reload', | ||
| 20 | STAT => 'stat', | ||
| 21 | # | ||
| 22 | RUNNING => 'running', | ||
| 23 | ALIVE => 'alive', | ||
| 24 | DEAD => 'dead', | ||
| 25 | NOCMD => 'nocmd', | ||
| 26 | # | ||
| 27 | STOPPED => 'stopped', | ||
| 28 | STARTED => 'started', | ||
| 29 | RELOADED => 'reloaded', | ||
| 30 | STATED => 'stated', | ||
| 31 | EXITED => 'exited', | ||
| 32 | # | ||
| 33 | SHUTDOWN => 'shutdown', | ||
| 34 | KILLME => 'killme', | ||
| 35 | PROC_ROOT => '/proc', | ||
| 36 | |||
| 37 | # JSON RPC | ||
| 38 | |||
| 39 | RPC_JSON => '2.0', | ||
| 40 | RPC_DEFAULT_ADDRESS => '127.0.0.1', | ||
| 41 | RPC_DEFAULT_PORT => '9505', | ||
| 42 | RPC_ERR_PARSE => -32700, | ||
| 43 | RPC_ERR_REQ => -32600, | ||
| 44 | RPC_ERR_METHOD => -32601, | ||
| 45 | RPC_ERR_PARAMS => -32602, | ||
| 46 | RPC_ERR_INTERNAL => -32603, | ||
| 47 | RPC_ERR_SERVER => -32099, | ||
| 48 | RPC_ERR_APP => -32001, | ||
| 49 | RPC_SRV_ERR_MIN => -32000, | ||
| 50 | RPC_SRV_ERR_MAX => -32768, | ||
| 51 | |||
| 52 | # logging | ||
| 53 | |||
| 54 | LOG_LEVELS => qr/info|warn|error|fatal|debug|trace/, | ||
| 55 | LOG_TYPES => qr/console|file|json|syslog/, | ||
| 56 | LOG_FACILITY => qr/auth|authpriv|cron|daemon|ftp|local[0-7]|lpr|mail|news|user|uucp/, | ||
| 57 | |||
| 58 | # alerts | ||
| 59 | |||
| 60 | ALERT_PRIORITY => qr/low|medium|high|info/i, | ||
| 61 | ALERT_FACILITY => qr/systems/i, | ||
| 62 | |||
| 63 | }, | ||
| 64 | exports => { | ||
| 65 | all => q/RPC_JSON RPC_DEFAULT_PORT RPC_DEFAULT_ADDRESS RPC_ERR_PARSE | ||
| 66 | RPC_ERR_REQ RPC_ERR_METHOD RPC_ERR_PARAMS RPC_ERR_INTERNAL | ||
| 67 | RPC_ERR_SERVER RPC_SRV_ERR_MAX RPC_SRV_ERR_MIN | ||
| 68 | RPC_ERR_APP XAS_QUEUE START STOP EXIT | ||
| 69 | RELOAD STAT RUNNING ALIVE DEAD STOPPED STARTED RELOADED | ||
| 70 | STATED EXITED SHUTDOWN KILLME PROC_ROOT NOCMD | ||
| 71 | LOG_LEVELS LOG_TYPES LOG_FACILITY ALERT_PRIORITY ALERT_FACILITY/, | ||
| 72 | any => q/RPC_JSON RPC_DEFAULT_PORT RPC_DEFAULT_ADDRESS RPC_ERR_PARSE | ||
| 73 | RPC_ERR_REQ RPC_ERR_METHOD RPC_ERR_PARAMS RPC_ERR_INTERNAL | ||
| 74 | RPC_ERR_SERVER RPC_SRV_ERR_MAX RPC_SRV_ERR_MIN | ||
| 75 | RPC_ERR_APP XAS_QUEUE START STOP EXIT | ||
| 76 | RELOAD STAT RUNNING ALIVE DEAD STOPPED STARTED RELOADED | ||
| 77 | STATED EXITED SHUTDOWN KILLME PROC_ROOT NOCMD | ||
| 78 | LOG_LEVELS LOG_TYPES LOG_FACILITY ALERT_PRIORITY ALERT_FACILITY/, | ||
| 79 | tags => { | ||
| 80 | jsonrpc => q/RPC_JSON RPC_DEFAULT_PORT RPC_DEFAULT_ADDRESS RPC_ERR_PARSE | ||
| 81 | RPC_ERR_REQ RPC_ERR_METHOD RPC_ERR_PARAMS RPC_ERR_INTERNAL | ||
| 82 | RPC_ERR_SERVER RPC_SRV_ERR_MAX RPC_SRV_ERR_MIN RPC_ERR_APP/, | ||
| 83 | supervisor => q/START STOP EXIT RELOAD STAT RUNNING ALIVE DEAD | ||
| 84 | STOPPED STARTED RELOADED STATED EXITED SHUTDOWN | ||
| 85 | KILLME PROC_ROOT NOCMD/, | ||
| 86 | logging => q/LOG_LEVELS LOG_TYPES LOG_FACILITY/, | ||
| 87 | alerts => q/ALERT_PRIORITY ALERT_FACILITY/, | ||
| 88 | |||
| 89 | } | ||
| 90 | } | ||
| 91 | 1 | ▶ | ; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 92 | |||
| 93 | 1 | 1; | |
| 94 | |||
| 95 | __END__ | ||
| 96 | |||
| 97 | =head1 NAME | ||
| 98 | |||
| 99 | XAS::Constants - A Perl extension for the XAS environment | ||
| 100 | |||
| 101 | =head1 SYNOPSIS | ||
| 102 | |||
| 103 | use XAS::Class | ||
| 104 | base => 'XAS::Base', | ||
| 105 | constant => 'TRUE FALSE' | ||
| 106 | ; | ||
| 107 | |||
| 108 | ... or ... | ||
| 109 | |||
| 110 | use XAS::Constants 'TRUE FALSE'; | ||
| 111 | |||
| 112 | =head1 DESCRIPTION | ||
| 113 | |||
| 114 | This module provides various constants for the XAS enviromnet. It inherits from | ||
| 115 | L<Badger::Constants|https://metacpan.org/pod/Badger::Constants> and also provides these additional | ||
| 116 | constants. | ||
| 117 | |||
| 118 | =head2 EXPORT | ||
| 119 | |||
| 120 | RPC_JSON RPC_DEFAULT_PORT RPC_DEFAULT_ADDRESS RPC_ERR_PARSE | ||
| 121 | RPC_ERR_REQ RPC_ERR_METHOD RPC_ERR_PARAMS RPC_ERR_INTERNAL | ||
| 122 | RPC_ERR_SERVER RPC_SRV_ERR_MAX RPC_SRV_ERR_MIN RPC_ERR_APP | ||
| 123 | |||
| 124 | LOG_TYPES LOG_FACILITY LOG_LEVELS | ||
| 125 | |||
| 126 | ALERT_PRIORITY ALERT_FACILITY | ||
| 127 | |||
| 128 | Along with these tags | ||
| 129 | |||
| 130 | jsonrpc | ||
| 131 | supervisor | ||
| 132 | logging | ||
| 133 | alerts | ||
| 134 | |||
| 135 | =head1 SEE ALSO | ||
| 136 | |||
| 137 | =over 4 | ||
| 138 | |||
| 139 | =item L<XAS|XAS> | ||
| 140 | |||
| 141 | =back | ||
| 142 | |||
| 143 | =head1 AUTHOR | ||
| 144 | |||
| 145 | Kevin Esteb, E<lt>kevin@kesteb.usE<gt> | ||
| 146 | |||
| 147 | =head1 COPYRIGHT AND LICENSE | ||
| 148 | |||
| 149 | Copyright (C) 2014 Kevin L. Esteb | ||
| 150 | |||
| 151 | This is free software; you can redistribute it and/or modify it under | ||
| 152 | the terms of the Artistic License 2.0. For details, see the full text | ||
| 153 | of the license at http://www.perlfoundation.org/artistic_license_2_0. | ||
| 154 | |||
| 155 | =cut | ||