Another newbie question re: STDERR and IPC::open3(), nowait() and zombies

Discussion in 'Perl' started by Dave Newberry, Oct 17, 2004.

  1. I've tried the FAQs and read the postings, but can't seem to find the magic
    combo. Any help out there would be greatly appreciated.

    I can't seem to get rid of the zombies. I'm attempting to use perldoc in a
    loop to save out all perlTk manpages to one document. Script follows:
    #######################

    #This is perl, v5.8.0 built for MSWin32-x86-multi-thread
    #Binary build 806 provided by ActiveState Corp.

    use IPC::Open3;
    use POSIX ":sys_wait_h";

    $mypreamble = 'TK::';

    #top level tk man page printed/saved via perldoc
    open(MY_TK, "tk");

    # empty out any previously existing output file
    open(MYFH, ">tk.txt");
    close(MYFH);

    #process every TK::<sub_topic> using perldoc
    while (readline *MY_TK) {
    if ($_ =~ /Tk::/) {
    $myremainder = $';
    chomp $myremainder;
    $mycmd = 'perldoc.bat';
    $myarg = $mypreamble . $myremainder;
    $mypid = open3("\*INFH", \*OUTFH, \*ERRFH, $mycmd, $myarg);

    #append this manpage to output file
    open(MYFH, ">>tk.doc");
    print MYFH $mycmd, " ", $myarg;
    close(MYFH);
    #???? lots of cmd.exe and perl.exe zombies (Wind32 style) despite the
    following!!!!
    do {
    $kid = waitpid($mypid , WNOHANG);
    } until $kid > 0;
    }
    }

    Thanks again to whomever!
     
    Dave Newberry, Oct 17, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. J. Romano
    Replies:
    0
    Views:
    174
    J. Romano
    Feb 10, 2004
  2. Mike Hunter

    Scary IPC::Open3 filehandle difference

    Mike Hunter, Oct 28, 2004, in forum: Perl Misc
    Replies:
    1
    Views:
    134
    Ilmari Karonen
    Dec 14, 2004
  3. Rocky Allen

    IPC::Open3

    Rocky Allen, Aug 24, 2005, in forum: Perl Misc
    Replies:
    4
    Views:
    131
    Joe Smith
    Aug 24, 2005
  4. RU
    Replies:
    4
    Views:
    137
    Darren Dunham
    Oct 3, 2007
  5. Peter Makholm

    IPC::Open3 and the error filehandle

    Peter Makholm, Oct 26, 2007, in forum: Perl Misc
    Replies:
    5
    Views:
    213
    Peter Makholm
    Oct 29, 2007
Loading...

Share This Page