http://danconia.org
Miroslav Suchy wrote:
Wiggins D'Anconia wrote:I am not sure if Open2 automagically autoflushes the IO so you may want to turn on autoflushing and try again to see if that helps. You should also turn on warnings with 'use warnings' and see if that gives any more information.Seting autoflushing on/off do not help.
Don't know why other than not flushing the buffers this would work any different from the command line than CGI.
When I turn the warnings on, I get this warning in apache error log:
Use of uninitialized value in concatenation (.) or string at /www/imprese.cz/sexy/no_mod_perl/test.cgi line 24, <Reader> line 1.
And that is because I try print $line and $line was only assigned by scalar(<Reader) which is undef (why, why, why - I'm going crazy).
When run from command line, there is no warnings at all.
Here is code without ispell (if you wanna try):
#!/usr/bin/perl -w
use strict;
use IPC::Open2;
use warnings;
use CGI;
my $pid = open2(
*Reader,
*Writer,
'/bin/cat',
);
my $q=new CGI;
print $q->header, $q->start_html;
print Writer "lupou\n";
my $line=scalar(<Reader>);
print scalar((defined $line) ? $line : 'undef');
print $q->end_html;
when run from command line it produce:
some http and html headers
lupou
some html foot
and as cgi under apache:
undef
instead of the string 'lupou'
Miroslav Suchy
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]