> > However, I cannot get this same module to actually send correctly the
> > captured output... Have you got any suggestions?
> 
> Well, if you have the output in a variable, just print it.

Trouble is, 'just printing it' doesn't seem to work. Here it my test script:

    [EMAIL PROTECTED] mkd]$ more cgi/mkdoc.cgi
    #!/usr/bin/perl
    use strict;
    use warnings;

    print "Content-Type: text/plain\n\n";
    unless ($ENV{REQUEST_METHOD} && $ENV{REQUEST_METHOD} eq 'HEAD')
    {
        print "Hello, World!";
    }
    [EMAIL PROTECTED] mkd]$ 


My MKDoc::Handler::Cache, a subclass of Apache::RegistryNG

package MKDoc::Handler::Cache;
use base qw /Apache::RegistryNG/;
use IO::Capture::Stdout;
use Data::Dumper;
use strict;
use warnings;
use Apache;
use Apache::Constants;

sub handler ($$)
{
    my ($class, $r) = (@_ >= 2) ? (shift, shift) : (__PACKAGE__, shift);
    $r->log_error ('We are in MKDoc::Handler::Cache');
    $r->log_error ($r->filename());

    my $fake_r = MKDoc::Handler::Cache::Capture->new ($r);
    my $ret    = $class->SUPER::handler ($fake_r);

    my $data = $fake_r->data();
    $r->log_error ($data);
    print $data;

    return $ret;
}


When I do a lynx --dump on the script, here is what I get:

[EMAIL PROTECTED] mkd]$ lynx --dump http://groucho/

    Looking up groucho
    groucho
    Making HTTP connection to groucho
    Sending HTTP request.
    HTTP request sent; waiting for response.
    Alert!: Unexpected network read error; connection aborted.
    Can't Access `http://groucho/'
    Alert!: Unable to access document.

    lynx: Can't access startfile 


And here's what's appearing in the error log:

    [Thu Nov 27 10:10:33 2003] [error] We are in MKDoc::Handler::Cache
    [Thu Nov 27 10:10:33 2003] [error] /opt/mkd/cgi/mkdoc.cgi
    [Thu Nov 27 10:10:33 2003] [error] Content-Type: text/plain

    Hello, World!


As you can see, I managed to capture the output (since I can make it appear in
the error log) but when I print it it doesn't seem to appear anywhere.

I have also tried to untie *STDOUT or even localize it, with no success.

I'm sorry to bother you guys with this stuff... I'm only -reluctantly- ever
invoking the dark powers of the mod_perl gurus spirits when I'm super-stuck,
which unfortunately is the case right now :(

Cheers,
-- 
Building a better web - http://www.mkdoc.com/
---------------------------------------------
Jean-Michel Hiver
[EMAIL PROTECTED]  - +44 (0)114 255 8097
Homepage: http://www.webmatrix.net/

-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html

Reply via email to