Re: Not able to write using Open2
- From: "Paul Lalli" <mritty@xxxxxxxxx>
- Date: 29 Nov 2005 07:55:14 -0800
Ashwin wrote:
>
> SOrry, I missee one quatation
> here is compiled code,
> is there no way I can get it done with open2?
Get *what* done? I don't see anywhere in the code below in which you
attempted to write to the process.
> use warnings;
> use strict;
> use IPC::Open2;
> use Cwd;
>
> my $currentdir=cwd();
> my $pid;
> chdir ("/source/internal/") or die "Cannot Change Directory";
> $pid = open2 (\*READ,\*MY_WRITE,"BuildInternal.pl") or die;
Here you open the process BuildInternal.pl, with a read filehandle READ
and a write filehandle MY_WRITE
> while (<READ>)
Here you begin reading from READ
> {
> print $_;
Here you print the lines read from READ out to STDOUT
> }
>
> print "MY_WRITE\n";
Here you print the string "MY_WRITE\n" out to STDOUT
>
> while (<READ>)
Here you again read from READ
> {
> print $_;
Here you again print the lines read from READ out to STDOUT
> }
>
> close MY_WRITE;
> close READ;
Here you close both filehandles.
What part of this code were you expecting to write anything to the
MY_WRITE filehandle?
Paul Lalli
.
- Follow-Ups:
- Re: Not able to write using Open2
- From: Ashwin
- Re: Not able to write using Open2
- References:
- Not able to write using Open2
- From: Ashwin
- Re: Not able to write using Open2
- From: Paul Lalli
- Re: Not able to write using Open2
- From: Ashwin
- Not able to write using Open2
- Prev by Date: Re: How to modify a XML file using Perl?
- Next by Date: Re: Addition of same value
- Previous by thread: Re: Not able to write using Open2
- Next by thread: Re: Not able to write using Open2
- Index(es):
Relevant Pages
|