You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Ville Skyttä <vi...@iki.fi> on 2003/01/21 22:41:14 UTC

[mp2] Apache::RequestRec, IPC::Open[23] problem

Hi,

The script below under mod_perl 1.99_08 (ModPerl::Registry), gives me
this:

  Can't locate object method "FILENO" via package
  "Apache::RequestRec" at /usr/lib/perl5/5.8.0/IPC/Open3.pm line 196.

A real world example of a script that has these problems is the W3C
Markup Validator,
<http://dev.w3.org/cvsweb/validator/httpd/cgi-bin/check?rev=1.200.2.79>.

The validator works under mod_perl 1, and I guess the test script would
as well (I'm unable to verify that at the moment, though).  Maybe a
mod_perl 2 bug/missing feature?

My installation is Red Hat 8.0, Apache 2.0.40, mod_perl 1.99_08 and Perl
5.8.0.  The test script:

  use IPC::Open2 qw(open2);
  use IO::File ();
  my $in  = IO::File->new_tmpfile();
  my $out = IO::File->new_tmpfile();
  print $in "foobar\n";
  seek $in, 0, 0;
  print "Content-Type: text/plain\n\n";
  my $pid = open2($out, $in, 'tee');
  undef $in;
  waitpid $pid, 0;
  seek $out, 0, 0;
  while (<$out>) {
    print;
  }
  undef $out;

Cheers,
-- 
\/ille Skyttä
ville.skytta at iki.fi



Re: [mp2] Apache::RequestRec, IPC::Open[23] problem

Posted by Stas Bekman <st...@stason.org>.
Ville Skyttä wrote:
> On Wed, 2003-01-22 at 08:10, Stas Bekman wrote:
> 
> 
>>Please try again with the latest cvs, I've just ported FILENO, OPEN and CLOSE 
>>interfaces from 1.0. Though I doubt that this will work, IPC::Open* have 
>>always had problems with mod_perl. IPC::Run should be used instead for now. 
>>Hopefully will be able to look more into this issue much later unless someone 
>>beats me to it.
> 
> 
> Thanks for the quick reply, Stas.  I tried it out and that particular
> error is gone now, but the W3C Validator still doesn't quite work,
> whereas as a normal CGI it does.  I didn't notice any errors, but valid
> pages just don't validate under mod_perl (they do as normal CGI).  I
> know this is a too vague explanation, but I don't have time to dig
> deeper now.

As I said, the IPC::Open* family is usually not working under mod_perl (1.0 
and 2.0). Nobody has looked into resolving this issue, mainly because IPC::Run 
seems to be a much better alternative. But that doesn't solve the problem for 
those who are stuck with an existing code and aren't able to adjust it. 
Therefore since IPC::Run provides the same functionality and more, may be a 
special IPC::Open* layer can be provided which will transparently replace 
IPC::Open* with IPC::Run.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


Re: [mp2] Apache::RequestRec, IPC::Open[23] problem

Posted by Ville Skyttä <vi...@iki.fi>.
On Wed, 2003-01-22 at 08:10, Stas Bekman wrote:

> Please try again with the latest cvs, I've just ported FILENO, OPEN and CLOSE 
> interfaces from 1.0. Though I doubt that this will work, IPC::Open* have 
> always had problems with mod_perl. IPC::Run should be used instead for now. 
> Hopefully will be able to look more into this issue much later unless someone 
> beats me to it.

Thanks for the quick reply, Stas.  I tried it out and that particular
error is gone now, but the W3C Validator still doesn't quite work,
whereas as a normal CGI it does.  I didn't notice any errors, but valid
pages just don't validate under mod_perl (they do as normal CGI).  I
know this is a too vague explanation, but I don't have time to dig
deeper now.

Cheers,
-- 
\/ille Skyttä
ville.skytta at iki.fi



Re: [mp2] Apache::RequestRec, IPC::Open[23] problem

Posted by Stas Bekman <st...@stason.org>.
Ville Skyttä wrote:
> Hi,
> 
> The script below under mod_perl 1.99_08 (ModPerl::Registry), gives me
> this:
> 
>   Can't locate object method "FILENO" via package
>   "Apache::RequestRec" at /usr/lib/perl5/5.8.0/IPC/Open3.pm line 196.
> 
> A real world example of a script that has these problems is the W3C
> Markup Validator,
> <http://dev.w3.org/cvsweb/validator/httpd/cgi-bin/check?rev=1.200.2.79>.
> 
> The validator works under mod_perl 1, and I guess the test script would
> as well (I'm unable to verify that at the moment, though).  Maybe a
> mod_perl 2 bug/missing feature?
> 
> My installation is Red Hat 8.0, Apache 2.0.40, mod_perl 1.99_08 and Perl
> 5.8.0.  The test script:
> 
>   use IPC::Open2 qw(open2);
>   use IO::File ();
>   my $in  = IO::File->new_tmpfile();
>   my $out = IO::File->new_tmpfile();
>   print $in "foobar\n";
>   seek $in, 0, 0;
>   print "Content-Type: text/plain\n\n";
>   my $pid = open2($out, $in, 'tee');
>   undef $in;
>   waitpid $pid, 0;
>   seek $out, 0, 0;
>   while (<$out>) {
>     print;
>   }
>   undef $out;

Please try again with the latest cvs, I've just ported FILENO, OPEN and CLOSE 
interfaces from 1.0. Though I doubt that this will work, IPC::Open* have 
always had problems with mod_perl. IPC::Run should be used instead for now. 
Hopefully will be able to look more into this issue much later unless someone 
beats me to it.

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com