Re: Not able to write using Open2



Paul Lalli wrote:

> 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

Hi,
sorry for missing the valid part
this part of the script
> print "MY_WRITE\n"; should have been
print MY_WRITE "4\n";
to clarify that value 4 need to be written in output handle and then a
carridge return so that called script gets value as 4

sorry for the trouble
--

.



Relevant Pages

  • Re: Opening .dat file in perl
    ... Paul Lalli wrote: ... use strict; ... perl fdmacdr.pl ... and then you're printing the value of that filehandle. ...
    (perl.beginners)
  • Re: FileHandle messes up Oracle connection
    ... >> I had a simple script which connected to an Oracle DB, ... >> ported the subs to a larger script, ... FileHandle is a deprecated wrapper around the ...
    (comp.lang.perl.misc)
  • Re: FileHandle messes up Oracle connection
    ... >> I had a simple script which connected to an Oracle DB, ... >> ported the subs to a larger script, ... FileHandle is a deprecated wrapper around the ...
    (comp.lang.perl.misc)
  • Re: IIS6 and CGI Upload
    ... This sounds like a bug in your CGI. ... What is the ACLs of the directory and file that the script is trying to ... opens a new filehandle; ...
    (microsoft.public.inetserver.misc)
  • Re: Assistance on code
    ... I am a bit confused on why serial in my script was not ... Global symbol "@array" requires explicit package name at .... ... Things that could be potential problems that my version improves upon: ... You are using a global bareword filehandle, ...
    (perl.beginners)