diff options
Diffstat (limited to 'Inject.pm')
-rw-r--r-- | Inject.pm | 35 |
1 files changed, 34 insertions, 1 deletions
@@ -18,8 +18,41 @@ Apache2::Module::add(__PACKAGE__, \@directives); sub Inject { my ($self, $parms, @args) = @_; + + # Validate arguments and construct corresponding directives + my @vars; + my @names = qw/InjectHead InjectFoot/; + for (@args) { + die 'Arguments to Inject directive cannot contain quotes' if /"/; + push @vars, 'PerlSetVar ' . (shift @names) . ' ' . $_; + } + + # Add relevant directives to current configuration $parms->add_config(['SetHandler perl-script', - 'PerlHandler Apache::Inject::Handler']); + 'PerlResponseHandler Apache::Inject::Handler', + @vars]); } 1; +__END__ + +=head1 NAME + +Apache::Inject - Apache directive for injecting HTML headers and footers + +=head1 SYNOPSIS + +DocumentRoot /uar/local/www/apache24/data +PerlModule Apache::Inject +<Directory /usr/local/www/apache24/data> + Inject head.html foot.html +</Directory> + +=head1 DESCRIPTION + +Apache::Inject is a mod_perl module that adds the Inject directive. +It injects a header before the body and (optionally) a footer after the body +of any requested HTML file. + +=cut + |