blib/lib/XAS/Lib/Modules/Environment.pm

filter: Statementstmt 12.3% 14 / 113 Branchbran 0.0% 0 / 82 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 28.5% 4 / 14 Podpod 83.3% 5 / 6 totaltotal 10.7% 23 / 215 CC 47 SCAR 67.7
CC
47
Cov
7%
init
1406.0
_load_msgs
12.0
__ANON__
12.0
CRAP 869.5
↑ Summary blib/lib/XAS/Lib/Stomp/Parser.pm »
1 package XAS::Lib::Modules::Environment;
2  
3 1 our $VERSION = '0.02';
4  
5 1 ▶use File::Basename;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Config::IniFiles;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Net::Domain qw(hostdomain);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 use XAS::Class
10 1 debug => 0,
11 version => $VERSION,
12 base => 'XAS::Singleton',
13 utils => 'dir_walk',
14 constants => ':logging',
15 filesystem => 'File Dir Path Cwd',
16 accessors => 'path host domain username script commandline',
17 mutators => 'mqserver mqport mxserver mxport mxtimeout msgs alerts xdebug',
18 1 ▶;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 # ------------------------------------------------------------------------
21 # Public Methods
22 # ------------------------------------------------------------------------
23  
24 sub mxmailer {
25 0 ▶ my $self = shift;
Subroutine mxmailer: not called CC=2 SCAR=17.9
Pod documented
26 0 my ($mailer) = $self->validate_params(\@_, [
27 { optional => 1, default => undef, regex => qr/sendmail|smtp/ }
28 ]);
29  
30 0 ▶ $self->{mxmailer} = $mailer if (defined($mailer));
Branch: 1 branch
BranchTrueFalseTotal
if defined $mailer 0 0 0
31  
32 0 return $self->{mxmailer};
33  
34 }
35  
36 sub mqlevel {
37 0 ▶ my $self = shift;
Subroutine mqlevel: not called CC=2 SCAR=17.9
Pod documented
38 0 my ($level) = $self->validate_params(\@_, [
39 { optional => 1, default => undef, regex => qr/(1\.0|1\.1|1\.2)/ },
40 ]);
41  
42 0 ▶ $self->{mqlevel} = $level if (defined($level));
Branch: 1 branch
BranchTrueFalseTotal
if defined $level 0 0 0
43  
44 0 return $self->{mqlevel};
45  
46 }
47  
48 sub log_type {
49 0 ▶ my $self = shift;
Subroutine log_type: not called CC=2 SCAR=17.9
Pod documented
50 0 my ($type) = $self->validate_params(\@_, [
51 { optional => 1, default => undef, regex => LOG_TYPES }
52 ]);
53  
54 0 ▶ $self->{log_type} = $type if (defined($type));
Branch: 1 branch
BranchTrueFalseTotal
if defined $type 0 0 0
55  
56 0 return $self->{log_type};
57  
58 }
59  
60 sub log_facility {
61 0 ▶ my $self = shift;
Subroutine log_facility: not called CC=2 SCAR=17.9
Pod documented
62 0 my ($type) = $self->validate_params(\@_, [
63 { optional => 1, default => undef, regex => LOG_FACILITY }
64 ]);
65  
66 0 ▶ $self->{log_facility} = $type if (defined($type));
Branch: 1 branch
BranchTrueFalseTotal
if defined $type 0 0 0
67  
68 0 return $self->{log_facility};
69  
70 }
71
72 sub get_msgs {
73 0 ▶ my $self = shift;
Subroutine get_msgs: not called CC=1 SCAR=6.9
Pod undocumented
74  
75 0 return $self->class->any_var('MESSAGES');
76  
77 }
78  
79 # ------------------------------------------------------------------------
80 # Private Methods
81 # ------------------------------------------------------------------------
82  
83 sub _load_msgs {
84 0 ▶ my $self = shift;
Subroutine _load_msgs: not called CC=3 SCAR=24.8
85  
86 0 my $messages = $self->class->hash_vars('MESSAGES');
87  
88 0 foreach my $path (@INC) {
89  
90 0 my $dir = Dir($path, 'XAS');
91  
92 0 ▶ if ($dir->exists) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dir->exists) 0 0 0
93  
94 dir_walk(
95 -directory => $dir,
96 -filter => $self->msgs,
97 -callback => sub {
98 0 ▶ my $file = shift;
Subroutine __ANON__: not called CC=3 SCAR=24.8
99  
100 0 my $cfg = Config::IniFiles->new(-file => $file->path);
101 0 ▶ if (my @names = $cfg->Parameters('messages')) {
Branch: 1 branch
BranchTrueFalseTotal
if (my(@names) = $cfg->Parameters("messages")) 0 0 0
102  
103 0 foreach my $name (@names) {
104  
105 0 $messages->{$name} = $cfg->val('messages', $name);
106  
107 }
108  
109 }
110  
111 }
112 0 );
113  
114 }
115  
116 }
117  
118 0 $self->class->var('MESSAGES', $messages);
119  
120 }
121  
122 sub init {
123 0 ▶ my $self = shift;
Subroutine init: not called CC=37 SCAR=72.5
Pod documented
124  
125 0 my $temp;
126 my $name;
127 0 my $path;
128 0 my $suffix;
129 0 my $commandline = $0;
130 0 my ($script) = ( $commandline =~ m#([^\\/]+)$# );
131  
132 0 foreach (@ARGV) {
133 0 ▶ $commandline .= /\s/
Branch: 1 branch
BranchTrueFalseTotal
/\s/ ? : 0 0 0
134 ? " \'" . $_ . "\'"
135 : " " . $_;
136 }
137  
138 # set some defaults
139  
140 0 $self->{alerts} = 1;
141 0 $self->{xdebug} = 0;
142 0 $self->{mxtimeout} = 60;
143 0 $self->{script} = $script;
144 0 $self->{path} = $ENV{'PATH'};
145 0 $self->{commandline} = $commandline;
146
147 # Initialize variables - these are defaults
148  
149 $self->{mqserver} = defined($ENV{'XAS_MQSERVER'})
150 0 ▶ ? $ENV{'XAS_MQSERVER'}
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_MQSERVER'} ? : 0 0 0
151 : 'localhost';
152  
153 $self->{mqport} = defined($ENV{'XAS_MQPORT'})
154 0 ▶ ? $ENV{'XAS_MQPORT'}
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_MQPORT'} ? : 0 0 0
155 : '61613';
156  
157 $self->{mqlevel} = defined ($ENV{'XAS_MQLEVEL'})
158 0 ▶ ? $ENV{'XAS_MQLEVEL'}
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_MQLEVEL'} ? : 0 0 0
159 : '1.0';
160  
161 $self->{mxserver} = defined($ENV{'XAS_MXSERVER'})
162 0 ▶ ? $ENV{'XAS_MXSERVER'}
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_MXSERVER'} ? : 0 0 0
163 : 'localhost';
164  
165 $self->{mxport} = defined($ENV{'XAS_MXPORT'})
166 0 ▶ ? $ENV{'XAS_MXPORT'}
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_MXPORT'} ? : 0 0 0
167 : '25';
168  
169 $self->{domain} = defined($ENV{'XAS_DOMAIN'})
170 0 ▶ ? $ENV{'XAS_DOMAIN'}
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_DOMAIN'} ? : 0 0 0
171 : hostdomain();
172  
173 0 ▶ $self->{msgs} = defined($ENV{'XAS_MSGS'})
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_MSGS'} ? : 0 0 0
174 ? qr/$ENV{'XAS_MSGS'}/i
175 : qr/.*\.msg$/i;
176  
177  
178 # platform specific
179  
180 0 my $OS = $^O;
181  
182 0 ▶ if ($OS eq "MSWin32") {
Branch: 1 branch
BranchTrueFalseTotal
if ($OS eq 'MSWin32') { } 0 0 0
183  
184 0 require Win32;
185  
186 $self->{host} = defined($ENV{'XAS_HOSTNAME'})
187 0 ▶ ? $ENV{'XAS_HOSTNAME'}
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_HOSTNAME'} ? : 0 0 0
188 : Win32::NodeName();
189  
190 $self->{root} = Dir(defined($ENV{'XAS_ROOT'})
191 0 ▶ ? $ENV{'XAS_ROOT'}
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_ROOT'} ? : 0 0 0
192 : ['C:', 'XAS']);
193  
194 $self->{etc} = Dir(defined($ENV{'XAS_ETC'})
195 ? $ENV{'XAS_ETC'}
196 0 ▶ : [$self->{root}, 'etc']);
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_ETC'} ? : 0 0 0
197  
198 $self->{tmp} = Dir(defined($ENV{'XAS_TMP'})
199 ? $ENV{'XAS_TMP'}
200 0 ▶ : [$self->{root}, 'tmp']);
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_TMP'} ? : 0 0 0
201  
202 $self->{var} = Dir(defined($ENV{'XAS_VAR'})
203 ? $ENV{'XAS_VAR'}
204 0 ▶ : [$self->{root}, 'var']);
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_VAR'} ? : 0 0 0
205  
206 $self->{lib} = Dir(defined($ENV{'XAS_LIB'})
207 ? $ENV{'XAS_LIB'}
208 0 ▶ : [$self->{root}, 'var', 'lib']);
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_LIB'} ? : 0 0 0
209  
210 $self->{log} = Dir(defined($ENV{'XAS_LOG'})
211 ? $ENV{'XAS_LOG'}
212 0 ▶ : [$self->{root}, 'var', 'log']);
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_LOG'} ? : 0 0 0
213  
214 $self->{run} = Dir(defined($ENV{'XAS_RUN'})
215 ? $ENV{'XAS_RUN'}
216 0 ▶ : [$self->{root}, 'var', 'run']);
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_RUN'} ? : 0 0 0
217  
218 $self->{spool} = Dir(defined($ENV{'XAS_SPOOL'})
219 ? $ENV{'XAS_SPOOL'}
220 0 ▶ : [$self->{root}, 'var', 'spool']);
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_SPOOL'} ? : 0 0 0
221  
222 $self->{mxmailer} = defined($ENV{'XAS_MXMAILER'})
223 0 ▶ ? $ENV{'XAS_MXMAILER'}
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_MXMAILER'} ? : 0 0 0
224 : 'smtp';
225  
226 0 $self->{username} = Win32::LoginName();
227  
228 } else {
229  
230 # this assumes a unix like working environment
231  
232 $self->{host} = defined($ENV{'XAS_HOSTNAME'})
233 0 ▶ ? $ENV{'XAS_HOSTNAME'}
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_HOSTNAME'} ? : 0 0 0
234 : `hostname -s`;
235  
236 0 chomp($self->{host});
237  
238 $self->{root} = Dir(defined($ENV{'XAS_ROOT'})
239 0 ▶ ? $ENV{'XAS_ROOT'}
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_ROOT'} ? : 0 0 0
240 : ['/']);
241  
242 $self->{etc} = Dir(defined($ENV{'XAS_ETC'})
243 ? $ENV{'XAS_ETC'}
244 0 ▶ : [$self->{root}, 'etc', 'xas']);
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_ETC'} ? : 0 0 0
245  
246 $self->{tmp} = Dir(defined($ENV{'XAS_TMP'})
247 0 ▶ ? $ENV{'XAS_TMP'}
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_TMP'} ? : 0 0 0
248 : ['/', 'tmp']);
249  
250 $self->{var} = Dir(defined($ENV{'XAS_VAR'})
251 ? $ENV{'XAS_VAR'}
252 0 ▶ : [$self->{root}, 'var']);
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_VAR'} ? : 0 0 0
253  
254 $self->{lib} = Dir(defined($ENV{'XAS_LIB'})
255 ? $ENV{'XAS_LIB'}
256 0 ▶ : [$self->{root}, 'var', 'lib', 'xas']);
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_LIB'} ? : 0 0 0
257  
258 $self->{log} = Dir(defined($ENV{'XAS_LOG'})
259 ? $ENV{'XAS_LOG'}
260 0 ▶ : [$self->{root}, 'var', 'log', 'xas']);
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_LOG'} ? : 0 0 0
261  
262 $self->{run} = Dir(defined($ENV{'XAS_RUN'})
263 ? $ENV{'XAS_RUN'}
264 0 ▶ : [$self->{root}, 'var', 'run', 'xas']);
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_RUN'} ? : 0 0 0
265  
266 $self->{spool} = Dir(defined($ENV{'XAS_SPOOL'})
267 ? $ENV{'XAS_SPOOL'}
268 0 ▶ : [$self->{root}, 'var', 'spool', 'xas']);
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_SPOOL'} ? : 0 0 0
269  
270 $self->{mxmailer} = defined($ENV{'XAS_MXMAILER'})
271 0 ▶ ? $ENV{'XAS_MXMAILER'}
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_MXMAILER'} ? : 0 0 0
272 : 'sendmail';
273  
274 0 $self->{username} = getpwuid($<);
275  
276 }
277  
278 # build some common paths
279  
280 $self->{sbin} = Dir(defined($ENV{'XAS_SBIN'})
281 ? $ENV{'XAS_SBIN'}
282 0 ▶ : [$self->{root}, 'sbin']);
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_SBIN'} ? : 0 0 0
283  
284 $self->{bin} = Dir(defined($ENV{'XAS_BIN'})
285 ? $ENV{'XAS_BIN'}
286 0 ▶ : [$self->{root}, 'bin']);
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_BIN'} ? : 0 0 0
287  
288 $self->{log_type} = defined($ENV{'XAS_LOG_TYPE'})
289 0 ▶ ? $ENV{'XAS_LOG_TYPE'}
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_LOG_TYPE'} ? : 0 0 0
290 : 'console';
291  
292 $self->{log_facility} = defined($ENV{'XAS_LOG_FACILITY'})
293 0 ▶ ? $ENV{'XAS_LOG_FACILITY'}
Branch: 1 branch
BranchTrueFalseTotal
defined $ENV{'XAS_LOG_FACILITY'} ? : 0 0 0
294 : 'local6';
295  
296 # create some common file names
297  
298 0 ($name, $path, $suffix) = fileparse($0, qr{\..*});
299  
300 0 $self->{logfile} = File($self->{log}, $name . '.log');
301 0 $self->{pidfile} = File($self->{run}, $name . '.pid');
302 0 $self->{cfgfile} = File($self->{etc}, $name . '.ini');
303  
304 # build some methods, saves typing
305  
306 0 for my $datum (qw( logfile pidfile cfgfile )) {
307  
308 $self->class->method($datum => sub {
309 0 ▶ my $self = shift;
Subroutine __ANON__: not called CC=2 SCAR=17.9
310 0 my ($p) = $self->validate_params(\@_, [
311 {optional => 1, default => undef, isa => 'Badger::Filesystem::File' }
312 ],
313 "xas.lib.modules.environment.$datum"
314 );
315  
316 0 ▶ $self->{$datum} = $p if (defined($p));
Branch: 1 branch
BranchTrueFalseTotal
if defined $p 0 0 0
317  
318 0 return $self->{$datum};
319  
320 0 });
321  
322 }
323  
324 0 for my $datum (qw( root etc sbin tmp var bin lib log run spool )) {
325  
326 $self->class->method($datum => sub {
327 0 ▶ my $self = shift;
Subroutine __ANON__: not called CC=2 SCAR=17.9
328 0 my ($p) = $self->validate_params(\@_, [
329 {optional => 1, default => undef, isa => 'Badger::Filesystem::Directory'}
330 ],
331 "xas.lib.modules.environment.$datum"
332 );
333  
334 0 ▶ $self->{$datum} = $p if (defined($p));
Branch: 1 branch
BranchTrueFalseTotal
if defined $p 0 0 0
335  
336 0 return $self->{$datum};
337  
338 0 });
339  
340 }
341
342 0 $self->_load_msgs();
343
344 0 return $self;
345  
346 }
347  
348 1 1;
349  
350 __END__
351  
352 =head1 NAME
353  
354 XAS::Lib::Modules::Environment - The base environment for the XAS environment
355  
356 =head1 SYNOPSIS
357  
358 Your program can use this module in the following fashion:
359  
360 use XAS::Class
361 version => '0.01',
362 base => 'XAS::Base',
363 ;
364  
365 $pidfile = $self->env->pidfile;
366 $logfile = $self->env->logfile;
367  
368 printf("The XAS root is %s\n", $self->env->root);
369  
370 =head1 DESCRIPTION
371  
372 This module describes the base environment for XAS. This module is implemented
373 as a singleton and will be auto-loaded when invoked.
374  
375 =head1 METHODS
376  
377 =head2 new
378  
379 This method will initialize the base module. It parses the current environment
380 using the following variables:
381  
382 =over 4
383  
384 =item B<XAS_ROOT>
385  
386 The root of the directory structure. On Unix like boxes this will be
387 /usr/local and Windows this will be C:\xas.
388  
389 =item B<XAS_LOG>
390  
391 The path for log files. On Unix like boxes this will be /var/log/xas and on
392 Windows this will be %XAS_ROOT%\var\log.
393  
394 =item B<XAS_RUN>
395  
396 The path for pid files. On Unix like boxes this will be /var/run/xas and
397 on Windows this will be %XAS_ROOT%\var\run.
398  
399 =item B<XAS_SPOOL>
400  
401 The base path for spool files. On Unix like boxes this will be /var/spool/xas
402 and on Windows this will be %XRS_ROOT%\var\spool.
403  
404 =item B<XAS_LIB>
405  
406 The path to the lib directory. On Unix like boxes this will be /var/lib/xas
407 and on Windows this will be %XAS_ROOT%\var\lib.
408  
409 =item B<XAS_ETC>
410  
411 The path to the etc directory. On Unix like boxes this will be /usr/local/etc
412 and on Windows this will be %XAS_ROOT%\etc
413  
414 =item B<XAS_BIN>
415  
416 The path to the bin directory. On Unix like boxes this will be /usr/local/bin
417 and on Windows this will be %XAS_ROOT%\bin.
418  
419 =item B<XAS_SBIN>
420  
421 The path to the sbin directory. On Unix like boxes this will be /usr/local/sbin
422 and on Windows this will be %XAS_ROOT%\sbin.
423  
424 =item B<XAS_HOSTNAME>
425  
426 The host name of the system. If not provided, on Unix the "hostname -s" command
427 will be used and on Windows Win32::NodeName() will be called.
428  
429 =item B<XAS_DOMAIN>
430  
431 The domain of the system: If not provided, then Net::Domain::hostdomain() will
432 be used.
433  
434 =item B<XAS_MQSERVER>
435  
436 The server where a STOMP enabled message queue server is located. Default
437 is "localhost".
438  
439 =item B<XAS_MQPORT>
440  
441 The port that server is listening on. Default is "61613".
442  
443 =item B<XAS_MQLEVL>
444  
445 This sets the STOMP protocol level. The default is v1.0.
446  
447 =item B<XAS_MXSERVER>
448  
449 The server where a SMTP based mail server resides. Default is "localhost".
450  
451 =item B<XAS_MXPORT>
452  
453 The port it is listening on. Default is "25".
454  
455 =item B<XAS_MXMAILER>
456  
457 The mailer to use for sending email. On Unix like boxes this will be "sendmail"
458 on Windows this will be "smtp".
459  
460 =item B<XAS_MSGS>
461  
462 The regex to use when searching for message files. Defaults to /.*\.msg/i.
463  
464 =item B<XAS_LOG_FACILITY>
465  
466 The syslog facility class to use. Defaults to 'local6'. It uses the syslog
467 conventions.
468  
469 =item B<XAS_LOG_TYPE>
470  
471 The log type. This can be "console", "file", "json" or "syslog". Defaults
472 to "console">
473  
474 =back
475  
476 =head2 alerts
477  
478 This method sets or returns wither to send alerts.
479  
480 =head2 xdebug
481  
482 This method sets or returns the status of debug.
483  
484 =head2 script
485  
486 This method returns the name of the script.
487  
488 =head2 commandline
489  
490 This method returns the complete commandline.
491  
492 =head2 log_type
493  
494 This method will return the currently defined log type. By default this is
495 "console". i.e. all logging will go to the terminal screen. Valid options
496 are "console", "file", "json" and "syslog'.
497  
498 =head2 log_facility
499  
500 This method will return the log facility class to use when writting to
501 syslog or json.
502  
503 Example
504  
505 $facility = $xas->log_facility;
506 $xas->log_facility('local6');
507  
508 =head2 logfile
509  
510 This method will return a pre-generated name for a log file. The name will be
511 based on the programs name with a ".log" extension, along with the path to
512 the XAS log file directory. Or you can store your own self generated log
513 file name.
514  
515 Example
516  
517 $logfile = $xas->logfile;
518 $xas->logfile("/some/path/mylogfile.log");
519  
520 =head2 pidfile
521  
522 This method will return a pre-generated name for a pid file. The name will be
523 based on the programs name with a ".pid" extension, along with the path to
524 the XAS pid file directory. Or you can store your own self generated pid
525 file name.
526  
527 Example
528  
529 $pidfile = $xas->pidfile;
530 $xas->pidfile("/some/path/myfile.pid");
531  
532 =head2 cfgfile
533  
534 This method will return a pre-generated name for a configuration file. The
535 name will be based on the programs name with a ".ini" extension, along with
536 the path to the XAS configuration file directory. Or you can store your own
537 self generated configuration file name.
538  
539 Example
540  
541 $inifile = $xas->cfgfile;
542 $xas->cfgfile("/some/path/myfile.cfg");
543  
544 =head2 mqserver
545  
546 This method will return the name of the message queue server. Or you can
547 store a different name for the server.
548  
549 Example
550  
551 $mqserver = $xas->mqserver;
552 $xas->mqserver('mq.example.com');
553  
554 =head2 mqport
555  
556 This method will return the port for the message queue server, or you store
557 a different port number for that server.
558  
559 =head2 mqlevel
560  
561 This method will returns the STOMP protocol level. or you store
562 a different level. It can use 1.0, 1.1 or 1.2.
563  
564 Example
565  
566 $mqlevel = $xas->mqlevel;
567 $xas->mqlevel('1.0');
568  
569 =head2 mxserver
570  
571 This method will return the name of the mail server. Or you can
572 store a different name for the server.
573  
574 Example
575  
576 $mxserver = $xas->mxserver;
577 $xas->mxserver('mail.example.com');
578  
579 =head2 mxport
580  
581 This method will return the port for the mail server, or you store
582 a different port number for that server.
583  
584 Example
585  
586 $mxport = $xas->mxport;
587 $xas->mxport('25');
588  
589 =head2 mxmailer
590  
591 This method will return the mailer to use for sending email, or you can
592 change the mailer used.
593  
594 Example
595  
596 $mxmailer = $xas->mxmailer;
597 $xas->mxmailer('smtp');
598  
599 =head1 ACCESSORS
600  
601 =head2 path
602  
603 This accessor returns the currently defined path for this program.
604  
605 =head2 root
606  
607 This accessor returns the root directory of the XAS environment.
608  
609 =head2 bin
610  
611 This accessor returns the bin directory of the XAS environment. The bin
612 directory is used to place executable commands.
613  
614 =head2 sbin
615  
616 This accessor returns the sbin directory of the XAS environment. The sbin
617 directory is used to place system level commands.
618  
619 =head2 log
620  
621 This accessor returns the log directory of the XAS environment.
622  
623 =head2 run
624  
625 This accessor returns the run directory of the XAS environment. The run
626 directory is used to place pid files and other such files.
627  
628 =head2 etc
629  
630 This accessor returns the etc directory of the XAS environment.
631 Application configuration files should go into this directory.
632  
633 =head2 lib
634  
635 This accessor returns the lib directory of the XAS environment. This
636 directory is used to store supporting file for the environment.
637  
638 =head2 spool
639  
640 This accessor returns the spool directory of the XAS environment. This
641 directory is used to store spool files generated within the environment.
642  
643 =head2 tmp
644  
645 This accessor returns the tmp directory of the XAS environment. This
646 directory is used to store temporary files.
647  
648 =head2 var
649  
650 This accessor returns the var directory of the XAS environment.
651  
652 =head2 host
653  
654 This accessor returns the local hostname.
655  
656 =head2 domain
657  
658 This access returns the domain name of the local host.
659  
660 =head2 username
661  
662 This accessor returns the effective username of the current process.
663  
664 =head2 msgs
665  
666 The accessor to return the regex for messages files.
667  
668 =head1 SEE ALSO
669  
670 =over 4
671  
672 =item L<XAS|XAS>
673  
674 =back
675  
676 =head1 AUTHOR
677  
678 Kevin L. Esteb, E<lt>kevin@kesteb.usE<gt>
679  
680 =head1 COPYRIGHT AND LICENSE
681  
682 Copyright (C) 2014 Kevin L. Esteb
683  
684 This is free software; you can redistribute it and/or modify it under
685 the terms of the Artistic License 2.0. For details, see the full text
686 of the license at http://www.perlfoundation.org/artistic_license_2_0.
687  
688 =cut
↑ Summary blib/lib/XAS/Lib/Stomp/Parser.pm »