| 1 | package XAS::Factory; | ||
| 2 | |||
| 3 | 1 | our $VERSION = '0.01'; | |
| 4 | |||
| 5 | use Badger::Factory::Class | ||
| 6 | 1 | debug => 0, | |
| 7 | version => $VERSION, | ||
| 8 | item => 'module', | ||
| 9 | path => 'XAS::Lib XAS::Lib::Modules', | ||
| 10 | modules => { | ||
| 11 | alert => 'XAS::Lib::Modules::Alerts', | ||
| 12 | email => 'XAS::Lib::Modules::Email', | ||
| 13 | environment => 'XAS::Lib::Modules::Environment', | ||
| 14 | log => 'XAS::Lib::Modules::Log', | ||
| 15 | logger => 'XAS::Lib::Modules::Log', | ||
| 16 | locking => 'XAS::Lib::Modules::Locking', | ||
| 17 | lockmgr => 'XAS::Lib::Modules::Locking', | ||
| 18 | spool => 'XAS::Lib::Modules::Spool', | ||
| 19 | spooler => 'XAS::Lib::Modules::Spool', | ||
| 20 | pidfile => 'XAS::Lib::Modules::PidFile', | ||
| 21 | } | ||
| 22 | 1 | ▶ | ; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 23 | |||
| 24 | 1 | 1; | |
| 25 | |||
| 26 | __END__ | ||
| 27 | |||
| 28 | =head1 NAME | ||
| 29 | |||
| 30 | XAS::Factory - A factory system for the XAS environment | ||
| 31 | |||
| 32 | =head1 SYNOPSIS | ||
| 33 | |||
| 34 | You can use this module in the following manner. | ||
| 35 | |||
| 36 | use XAS::Factory; | ||
| 37 | |||
| 38 | my $env = XAS::Factory->module('environment'); | ||
| 39 | |||
| 40 | ... or ... | ||
| 41 | |||
| 42 | my $env = XAS:Factory->module('Environment'); | ||
| 43 | |||
| 44 | Either of the above statements will load the L<XAS::Lib::Modules::Environment|XAS::Lib::Modules::Environment> module. | ||
| 45 | |||
| 46 | =head1 DESCRIPTION | ||
| 47 | |||
| 48 | This module is a factory system for the XAS environment. It will load and | ||
| 49 | initialize modules on demand. The advantage is that you don't need to load | ||
| 50 | all your modules at the beginning of your program. You also don't need to | ||
| 51 | know where individual modules live. And this system can provide nice alias | ||
| 52 | for long module names. This should lead to cleaner more readable programs. | ||
| 53 | |||
| 54 | =head1 MODULES | ||
| 55 | |||
| 56 | The following modules have been defined. | ||
| 57 | |||
| 58 | =over 4 | ||
| 59 | |||
| 60 | =item B<alert> | ||
| 61 | |||
| 62 | This will load L<XAS::Lib::Modules::Alerts|XAS::Lib::Modules::Alerts>. | ||
| 63 | |||
| 64 | =item B<email> | ||
| 65 | |||
| 66 | This will load L<XAS::Lib::Modules::Email|XAS::Lib::Modules::Email>. | ||
| 67 | |||
| 68 | =item B<environment> | ||
| 69 | |||
| 70 | This will load L<XAS::Lib::Modules::Environment|XAS::Lib::Modules::Environment> | ||
| 71 | |||
| 72 | =item B<log logger> | ||
| 73 | |||
| 74 | This will load L<XAS::Lib::Modules::Log|XAS::Lib::Modules::Log> | ||
| 75 | |||
| 76 | =item B<locking lockmgr> | ||
| 77 | |||
| 78 | This will load L<XAS::Lib::Modules::Locking|XAS::Lib::Modules::Locking>. | ||
| 79 | |||
| 80 | =item B<pidfile> | ||
| 81 | |||
| 82 | This will load L<XAS::Lib::Modules::PidFile|XAS::Lib::Modules::PidFile>. | ||
| 83 | |||
| 84 | =item B<spool spooler> | ||
| 85 | |||
| 86 | This will load L<XAS::Lib::Modules::Spool|XAS::Lib::Modules::Spool>. | ||
| 87 | |||
| 88 | =back | ||
| 89 | |||
| 90 | =head1 METHODS | ||
| 91 | |||
| 92 | =head2 module | ||
| 93 | |||
| 94 | This method loads the named module and passes any parameters to that module. | ||
| 95 | |||
| 96 | =head1 SEE ALSO | ||
| 97 | |||
| 98 | =over 4 | ||
| 99 | |||
| 100 | =item L<XAS|XAS> | ||
| 101 | |||
| 102 | =back | ||
| 103 | |||
| 104 | =head1 AUTHOR | ||
| 105 | |||
| 106 | Kevin L. Esteb, E<lt>kevin@kesteb.usE<gt> | ||
| 107 | |||
| 108 | =head1 COPYRIGHT AND LICENSE | ||
| 109 | |||
| 110 | Copyright (C) 2014 Kevin L. Esteb | ||
| 111 | |||
| 112 | This is free software; you can redistribute it and/or modify it under | ||
| 113 | the terms of the Artistic License 2.0. For details, see the full text | ||
| 114 | of the license at http://www.perlfoundation.org/artistic_license_2_0. | ||
| 115 | |||
| 116 | =cut | ||