Using IPC::open2 under mod_perl

From: Antonio (gulli_at_di.unipi.it)
Date: 05/17/04

  • Next message: Markus Kemp: "Making remote procedure calls"
    Date: 17 May 2004 05:11:21 -0700
    
    

    Hi mod_perl gurus,

    the following piece of code works well under a normal cgi:
        
    local(*META, *HIS_IN); # Create local handles if needed.
    $childpid = open2(\*META, \*HIS_IN, $queryString)
            or print STDERR "can't open pipe $queryString $!";

    while ($line=<META>){

    ...

    }
    close(META);
    close(HIS_IN);
    waitpid($childpid, 0);

    But it fails under mod_perl Apache/2.0.49 (Unix) mod_perl/1.99_13
    Perl/v5.8.0
    I'm not able to see any output from the open2ed command.

    Any help will be appreciated.

    PS: the original problem is that using open ("command |") the command
    remains appended as zombie. So i'm trying to switch to open2 for
    accessing waitpid.
    Any alternative solution?


  • Next message: Markus Kemp: "Making remote procedure calls"

    Relevant Pages

    • Re: alarm() functionality from the shell
      ... > obtain stdout and stderr, and retain the return code. ... > command will hang indefinitely, and therefore I'd like to be able to kill it ... Personally I don't think using temporary files is hackery. ... I don't know how portable the waitpid implementation is. ...
      (comp.unix.programmer)
    • Re: [SLE] Confilcts with apt sources?
      ... > that removes pixieplus. ... > I can provide an alternative solution to this libjasper thing later. ... Using the 'apt --force-rpm dist-upgrade' command ...
      (SuSE)
    • Re: Retrieving command exit code with open3
      ... >> zombie and stick around for the waitpid. ... > successfully provide an exit code of 0 in $?. ... open3 code encounters an error after it does the fork but before it does ... the exec of the command you are running, it can print useful diagnostics to ...
      (comp.lang.perl.misc)
    • Re: Duplicating command line arguments
      ... Alper ATICI wrote: ... >>alternative solution. ... So your point is apparently that you think the only way to make a backup ... which case "mv" is the right command. ...
      (comp.unix.shell)