| Apache-OutputChain documentation | Contained in the Apache-OutputChain distribution. |
Apache::PassExec - run CGI and catch its output
In the conf/access.conf file of your Apache installation add lines
<Files *.html> SetHandler perl-script PerlHandler Apache::OutputChain Apache::GzipChain Apache::PassExec </Files>
Runs a script (process) and fetches its output, passes it to next chained handlers.
(c) 1997--1998 Andreas Koenig, Jan Pazdziora
| Apache-OutputChain documentation | Contained in the Apache-OutputChain distribution. |
package Apache::PassExec; use Apache::Constants ':common'; use FileHandle; use strict; use vars qw($VERSION $BUFFERSIZE); $BUFFERSIZE = 16384; $VERSION = "0.05"; sub BUFFERSIZE { my($self,$new) = @_; $new += 0 if $new; $BUFFERSIZE = $new || $BUFFERSIZE || 16384; } sub handler { my $r = shift; my $filename = $r->filename(); my $fh; if (-f $filename and -x _ and $fh = FileHandle->new("$filename |")) { print STDERR "$filename |\n"; my $headers; { local $/ = "\n\n"; $headers = <$fh>; $r->send_cgi_header($headers); } my $buf; local $\; while (defined($buf = <$fh>)){ print $buf; } $fh->close; return OK; } else { return NOT_FOUND; } } 1; __END__