in reply to Re: open2 on Windows NT
in thread open2 on Windows NT

I have written a perl module to interface to a cli ui. Here is a snippet of code from the module
use IPC::Open2; use Symbol; sub connect_to_cli { my $rdr = gensym(); my $wtr = gensym(); my $pid = open2( $rdr, $wtr, $cmdline ); return $pid; }
And from a script that uses that module
use MyModule; my $session = new MyModule(); $pid = $session->connect_to_cli();
Running the perl script causes things to get stuck on the open2 call. But if I use the open2 call in a perl script it works fine.
use IPC::Open2; use Symbol; my $rdr = gensym(); my $wtr = gensym(); my $pid = open2( $rdr, $wtr, $cmdline ); print "pid = $pid\n";
Soraia

Edit by tye

Replies are listed 'Best First'.
(tye)Re: open2 on Windows NT
by tye (Sage) on May 31, 2001 at 20:30 UTC

    Your connect_to_cli is "throwing away" $rdr and $wtr (which should close them) and this may be causing your problems (it certainly makes this subroutinen pretty useless).

            - tye (but my friends call me "Tye")
Formatting...
by John M. Dlugosz (Monsignor) on May 31, 2001 at 18:51 UTC
    Please insert some <CODE> tags around that, and eyeball it in the preview window before submitting—your code is all flowed into a paragraph (see Site How To).

    IAC, print out the value of $cmdline just before making the call to make sure it's as you think it should be.