Something changed between 2.41 and 2.45 WRT to how Apache::Filter
interacts with Apache::ASP. I was successful thru vers 2.41 in
stacking some mod_perl filter handlers I wrote to do my header,
nav, footer parts of my pages.
By changing only the version of Apache::ASP to 2.45, my filter
handlers fail to work. Any ideas or similar experiences out there?
I didn't see anything in the change logs that looked too obvious;
I'll dig deeper into the code in the morning.
I've included the two handler files below. A typical http.conf entry
might look like:
<FilesMatch "\.asp$">
SetHandler perl-script
PerlModule Apache::Filter
PerlModule Apache::ASP
PerlSetVar Filter On
PerlSetVar AutoHeaders On
PerlSetVar AutoHeadersHeadFile head.inc
PerlSetVar AutoHeadersFootFile foot.inc
## stack handlers for auto header/nav/footer
PerlHandler Apache::FilterHeader Apache::ASP Apache::FilterSendHeader
:
:
## more stuff here
:
:
</FilesMatch>
and you supply the head.inc and foot.inc files wherever a
<!--#include file=XXXXXX--> line would find them.
-Broc
############################################################################
package Apache::FilterHeader;
use strict;
use Apache::Constants qw(:common);
use Apache::Log;
sub handler {
my $r = shift;
$r = $r->filter_register(); ## returns Apache::Filter subclass of Apache
## $r->deterministic(1);
my $file = $r->filename();
return DECLINED unless ( $file =~ /(\.asp|\..*html)$/ );
## be sure we want auto headers here.
my $AutoHeaders = $r->dir_config('AutoHeaders') || 'Off';
my $auto = 0;
if ( $AutoHeaders =~ m/^on$/io ) {
$auto = 1;
}
return DECLINED unless ( $auto );
## get our header and footer file
## check the notes() for printer-friendly settings
my $pf_headinc = $r->pnotes('pf_HEADER');
my $pf_footinc = $r->pnotes('pf_FOOTER');
my $headinc = $pf_headinc || $r->dir_config('AutoHeadersHeadFile') || '';
my $footinc = $pf_footinc || $r->dir_config('AutoHeadersFootFile') || '';
## ok, here we go...
$r->content_type("text/html");
# $r->send_http_header;
my ($fh, $status) = $r->filter_input();
if ( $status != OK ) {
## some kind of error
#return $status;
print <$fh>, "\n";
return OK; ## let Apache::ASP pick it up from here...
} else {
my @X = (); ## dummy just to get header includes to be dynamic
## normal
if ( $headinc and $headinc !~ /^none$/io ) {
my @h = split(',',$headinc);
for ( @h ) {
print "<!--#include file=$_ args=@X-->\n"
}
}
print <$fh>, "\n";
if ( $footinc and $footinc !~ /^none$/io ) {
my @h = split(',',$footinc);
for ( @h ) {
print "<!--#include file=$_-->\n"
}
}
return OK;
}
}
1;
############################################################################
package Apache::FilterSendHeader;
use strict;
use Apache::Constants qw(:common);
use Apache::Log;
sub handler {
my $r = shift;
$r = $r->filter_register(); ## returns Apache::Filter subclass of Apache
## $r->deterministic(1);
my $file = $r->filename();
return DECLINED unless ( $file =~ /(\.asp|\..*html)$/ );
## be sure we want auto headers here.
my $AutoHeaders = $r->dir_config('AutoHeaders') || 'Off';
my $auto = 0;
if ( $AutoHeaders =~ m/^on$/io ) {
$auto = 1;
}
#print $r->log->notice("autoheaders=$auto");
return DECLINED unless ( $auto );
## ok, here we go...
# $r->content_type("text/html");
$r->send_http_header;
my ($fh, $status) = $r->filter_input();
if ( $status != OK ) {
## some kind of error
return $status;
} else {
## normal
#print $r->log->notice($r->filename);
print <$fh>, "\n";
return OK;
}
}
1;
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]