[Catalyst] Running system commands under FastCGI with IPC::Cmd / IPC::Run

Larry Leszczynski larryl at emailplus.org
Tue Oct 26 17:15:44 GMT 2010


Hi Ian -

> On 10/21/2010 2:43 PM, Ian Sillitoe wrote:
> >
> > This works under the test server, but throws the following error
> > under FastCGI:
> >
> > |"Can't locate object method "FILENO" via package "FCGI::Stream" at /home/ian/perl5/lib/perl5/IPC/Run.pm line 1115.

On Thu, 21 Oct 2010 15:29 -0400, "Stuart Watt" <swatt at infobal.com>
wrote:
> 
> You may want to check your version of FCGI. There are previous reports
> of related issues, which seem to be an interaction between IPC::*
> modules expectations of standard input/output/error, and FCGI, which
> fakes them. See
> http://www.mail-archive.com/ports@openbsd.org/msg16948.html for an
> example. In my FCGI, the FILENO method is present, but this appears to
> have been added in version 0.67_01 on 20 Dec 2009 - this is pretty
> recent and your Perl may not include it.

If you can't upgrade (or upgrading doesn't fix things), you can also do
something like this before the IPC call:

    # HACK HACK HACK
    # Fix for running IPC::Run under FastCGI
    # See: http://www.mail-archive.com/ports@openbsd.org/msg16948.html
    #
    unless (exists &FCGI::Stream::FILENO)
    {
        *FCGI::Stream::FILENO = sub { return -2 };
    }


HTH,
Larry



More information about the Catalyst mailing list