Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Child process reading <STDIN> from parent

by Laurent_R (Canon)
on Oct 15, 2013 at 07:15 UTC ( [id://1058247]=note: print w/replies, xml ) Need Help??


in reply to Child process reading <STDIN> from parent

My question, how to i pass on this data from parent to child?

You mean from child to parent, don't you? Otherwise it does not make sense to me.

  • Comment on Re: Child process reading <STDIN> from parent

Replies are listed 'Best First'.
Re^2: Child process reading <STDIN> from parent
by rjohn1 (Sexton) on Oct 15, 2013 at 07:55 UTC
    My parent program launches the child like below:

    parent.pl

    =========

    ..... launch_chld{ my $cmd = "val_report.pl killall"; my $h = IO::Handle->new; die "IO::Handle->new failed." unless defined $h; open $h, $cmd . ' 2>&1 |'; $h->autoflush(1); }
    ********************************************

    val_report.pl

    =========

    .... ... process_args{ if(XYZ){ print "Do you really want XYZ. <YES> or <NO>"; die "Cant proceed as confirmation is NO" if(<> ne 'YES'); } }
    ****************************************

    Now process args will expect a input from user which in this case is parent.pl.

    The question is how do i pass a "YES" or "NO" to process_args?

      If I understand correctly the problem is not just that you're trying to read from STDOUT or write in STDIN of another process, it's that you're trying to do both at once.

      perlopentut still gives you the answer on that one: it redirects to the perlipc documentation on bidirectionnal communication with another process. This seems quite simple, all you have to think about is disable buffering on both sides.

      Just to add the $cmd also does o/p to stdout which i want to process which i capture via Tk::fileevent

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1058247]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (6)
As of 2024-04-19 20:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found