| 1 | |||
| 2 | package Apache2::ASP::ConfigNode::System; | ||
| 3 | |||
| 4 | use strict; | ||
| 5 | use warnings 'all'; | ||
| 6 | use base 'Apache2::ASP::ConfigNode'; | ||
| 7 | use Apache2::ASP::ConfigNode::System::Settings; | ||
| 8 | |||
| 9 | |||
| 10 | #============================================================================== | ||
| 11 | sub new | ||
| 12 | { | ||
| 13 | my $class = shift; | ||
| 14 | |||
| 15 | my $s = $class->SUPER::new( @_ ); | ||
| 16 | $s->{settings} = Apache2::ASP::ConfigNode::System::Settings->new( $s->{settings} || { setting => [ ] } ); | ||
| 17 | |||
| 18 | return $s; | ||
| 19 | }# end new() | ||
| 20 | |||
| 21 | |||
| 22 | #============================================================================== | ||
| 23 | sub libs | ||
| 24 | { | ||
| 25 | my $s = shift; | ||
| 26 | |||
| 27 | @{ $s->{libs}->{lib} }; | ||
| 28 | }# end libs() | ||
| 29 | |||
| 30 | #============================================================================== | ||
| 31 | sub load_modules | ||
| 32 | { | ||
| 33 | my $s = shift; | ||
| 34 | |||
| 35 | @{ $s->{load_modules}->{module} }; | ||
| 36 | }# end libs() | ||
| 37 | |||
| 38 | #============================================================================== | ||
| 39 | sub env_vars | ||
| 40 | { | ||
| 41 | my $s = shift; | ||
| 42 | |||
| 43 | @{ $s->{env_vars}->{var} }; | ||
| 44 | }# end libs() | ||
| 45 | |||
| 46 | #============================================================================== | ||
| 47 | sub post_processors | ||
| 48 | { | ||
| 49 | my $s = shift; | ||
| 50 | |||
| 51 | @{ $s->{post_processors}->{class} }; | ||
| 52 | }# end libs() | ||
| 53 | |||
| 54 | |||
| 55 | #============================================================================== | ||
| 56 | sub settings | ||
| 57 | { | ||
| 58 | my $s = shift; | ||
| 59 | |||
| 60 | return wantarray ? @{ $s->{settings}->{setting} } : $s->{settings}; | ||
| 61 | }# end settings() | ||
| 62 | |||
| 63 | 1;# return true: | ||
| 64 | |||
| 65 | =pod | ||
| 66 | |||
| 67 | =head1 NAME | ||
| 68 | |||
| 69 | Apache2::ASP::ConfigNode::System - the 'system' portion of the config. | ||
| 70 | |||
| 71 | =head1 SYNOPSIS | ||
| 72 | |||
| 73 | my $system = $Config->system; | ||
| 74 | |||
| 75 | =head1 DESCRIPTION | ||
| 76 | |||
| 77 | This package provides special access to the elements specific to the C<system> | ||
| 78 | portion of the XML config file. | ||
| 79 | |||
| 80 | =head1 PUBLIC PROPERTIES | ||
| 81 | |||
| 82 | =head2 libs | ||
| 83 | |||
| 84 | A list of library paths that should be included into C<@INC>. | ||
| 85 | |||
| 86 | =head2 load_modules | ||
| 87 | |||
| 88 | A list of Perl modules that should be loaded automatically. | ||
| 89 | |||
| 90 | =head2 post_processors | ||
| 91 | |||
| 92 | A list of L<Apache2::ASP::ConfigPostProcessor> modules that should be given the ability to alter the config before | ||
| 93 | it is considered "ready for use" by the rest of the application. | ||
| 94 | |||
| 95 | =head2 env_vars | ||
| 96 | |||
| 97 | A hash of C<%ENV> variables that should be set. | ||
| 98 | |||
| 99 | =head2 settings | ||
| 100 | |||
| 101 | A collection of special read-only values that should be available throughout the application. | ||
| 102 | |||
| 103 | Examples include encryption keys, API keys and username/password combos to access remote services. | ||
| 104 | |||
| 105 | =head1 BUGS | ||
| 106 | |||
| 107 | It's possible that some bugs have found their way into this release. | ||
| 108 | |||
| 109 | Use RT L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Apache2-ASP> to submit bug reports. | ||
| 110 | |||
| 111 | =head1 HOMEPAGE | ||
| 112 | |||
| 113 | Please visit the Apache2::ASP homepage at L<http://www.devstack.com/> to see examples | ||
| 114 | of Apache2::ASP in action. | ||
| 115 | |||
| 116 | =head1 AUTHOR | ||
| 117 | |||
| 118 | John Drago <jdrago_999@yahoo.com> | ||
| 119 | |||
| 120 | =head1 COPYRIGHT AND LICENSE | ||
| 121 | |||
| 122 | Copyright 2007 John Drago, All rights reserved. | ||
| 123 | |||
| 124 | This software is free software. It may be used and distributed under the | ||
| 125 | same terms as Perl itself. | ||
| 126 | |||
| 127 | =cut | ||
| 128 | |||
| 129 |