| 1 | |||
| 2 | package Apache2::ASP::ConfigPostProcessor; | ||
| 3 | |||
| 4 | use strict; | ||
| 5 | use warnings 'all'; | ||
| 6 | |||
| 7 | |||
| 8 | #============================================================================== | ||
| 9 | sub new | ||
| 10 | { | ||
| 11 | my ($class, %args) = @_; | ||
| 12 | |||
| 13 | return bless \%args, $class; | ||
| 14 | }# end new() | ||
| 15 | |||
| 16 | |||
| 17 | #============================================================================== | ||
| 18 | sub post_process($$); | ||
| 19 | |||
| 20 | 1;# return true: | ||
| 21 | |||
| 22 | =pod | ||
| 23 | |||
| 24 | =head1 NAME | ||
| 25 | |||
| 26 | Apache2::ASP::ConfigPostProcessor - Base class for configuration post-processors | ||
| 27 | |||
| 28 | =head1 SYNOPSIS | ||
| 29 | |||
| 30 | package My::ConfigPostProcessor; | ||
| 31 | |||
| 32 | use strict; | ||
| 33 | use warnings 'all'; | ||
| 34 | use base 'Apache2::ASP::ConfigPostProcessor'; | ||
| 35 | |||
| 36 | sub post_process { | ||
| 37 | my ($self, $config) = @_; | ||
| 38 | |||
| 39 | $config->{mood} = 'Happy'; | ||
| 40 | |||
| 41 | # Don't forget to return the new $config object: | ||
| 42 | return $config; | ||
| 43 | } | ||
| 44 | |||
| 45 | 1;# return true: | ||
| 46 | |||
| 47 | Then, in the C<apache2-asp-config.xml>: | ||
| 48 | |||
| 49 | <?xml version="1.0"?> | ||
| 50 | <config> | ||
| 51 | ... | ||
| 52 | <system> | ||
| 53 | ... | ||
| 54 | <post_processors> | ||
| 55 | <class>My::PostProcessor</class> | ||
| 56 | ... | ||
| 57 | </post_processors> | ||
| 58 | ... | ||
| 59 | </system> | ||
| 60 | ... | ||
| 61 | </config> | ||
| 62 | |||
| 63 | Then, somewhere else in the web application... | ||
| 64 | |||
| 65 | if( $Config->mood eq 'Happy' ) { | ||
| 66 | # Don't worry - be happy :) | ||
| 67 | } | ||
| 68 | |||
| 69 | =head1 ABSTRACT METHODS | ||
| 70 | |||
| 71 | All subclasses must implement the following method(s) at a minimum: | ||
| 72 | |||
| 73 | =head2 post_process( $self, Apache2::ASP::Config $Config ) | ||
| 74 | |||
| 75 | Should do B<something> to the $Config object, B<and then *return* that new $Config object>. | ||
| 76 | |||
| 77 | =head1 BUGS | ||
| 78 | |||
| 79 | It's possible that some bugs have found their way into this release. | ||
| 80 | |||
| 81 | Use RT L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Apache2-ASP> to submit bug reports. | ||
| 82 | |||
| 83 | =head1 HOMEPAGE | ||
| 84 | |||
| 85 | Please visit the Apache2::ASP homepage at L<http://www.devstack.com/> to see examples | ||
| 86 | of Apache2::ASP in action. | ||
| 87 | |||
| 88 | =head1 AUTHOR | ||
| 89 | |||
| 90 | John Drago <jdrago_999@yahoo.com> | ||
| 91 | |||
| 92 | =head1 COPYRIGHT AND LICENSE | ||
| 93 | |||
| 94 | Copyright 2007 John Drago, All rights reserved. | ||
| 95 | |||
| 96 | This software is free software. It may be used and distributed under the | ||
| 97 | same terms as Perl itself. | ||
| 98 | |||
| 99 | =cut | ||
| 100 |