Luis Henrique Cassis Fagundes ([EMAIL PROTECTED]) said something to this effect:
> The problem I'm having is not to write the contents, the problem is to
> get the contents I'm going to write. I must get the output of the
> dynamic page (that can be CGI, PHP, SSI, or anything) before it's sent
> to the browser... I'm now trying to do it with Apache::OutputChain.
if you are writing the handler to write output specifically, then you would
write it in such a way as to produce the output and write it to disk, as if
it were going to run via cron or from the command line. Put the various
"use Apache::*" lines at the top, write a few subroutines to generate the
actual content (but write them as if there were *not* apache modules), and
then do an internal redirect.
package Apache::404Fixer;
use Apache::Constants qw/OK SERVER_ERROR/;
use MyPkg; # where your routines are kept
sub handler {
my $r = shift()->main;
my $status = generate_the_real_content($r->filename);
return SERVER_ERROR unless $status;
$r->internal_redirect($r->uri);
return OK;
}
sub generate_real_content {
my $filename = shift;
use DBI; # or whatever you need to get your data
my $dbh = DBI->connect(...);
my $data = $dbh->select_everything_that_i_want;
# format_correctly does the HTML-fying of $data
my $formatted = MyPkg::format_correctly($data);
open(DATA,">$filename") or return undef;
print DATA $formatted;
close(DATA);
return 1;
}
Is this what you mean, more or less?
(darren)
--
Half of all epigrams exaggerate, and this is one of them.