Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Seek in IPC::Open2 modules handle

by Samy_rio (Vicar)
on May 20, 2009 at 09:16 UTC ( #765150=perlquestion: print w/ replies, xml ) Need Help??
Samy_rio has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,
I am posting the the url and getting the response using IPC::Open2 modules. I am getting the output using $rdrfh handle.

I fetch some data from $rdrfh handle and again i need the data from the start position.

I tried seek funciton with the $rdrfh handle, but it's not working

use Fcntl qw(SEEK_SET); use IPC::Open2; ... open2($rdrfh, $wtrfh, 'some cmd and args'); ... seek($rdrfh, 0,0); #not working seek($rdrfh, 0,SEEK_SET); #not working

Is it possible to seek the IPC::Open2 module file handle? How?

Thanks in advance

Regards,
Velusamy R.


eval"print uc\"\\c$_\""for split'','j)@,/6%@0%2,`e@3!-9v2)/@|6%,53!-9@2~j';

Comment on Seek in IPC::Open2 modules handle
Select or Download Code
Re: Seek in IPC::Open2 modules handle
by Corion (Pope) on May 20, 2009 at 09:17 UTC

    No - in general, pipes from other programs are not seekable.

    If you need a seekable file, have the generating program write to a temporary file and read from that temporary file.

Re: Seek in IPC::Open2 modules handle
by ikegami (Pope) on May 20, 2009 at 14:36 UTC
    If you liken the file handle contents to words, a file is like a book (you can seek through it) while a pipe is like an oral conversation. Unless you happen to record it, you can't rewind it. You definitely can't skip forward.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://765150]
Approved by targetsmart
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (10)
As of 2014-08-01 12:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Who would be the most fun to work for?















    Results (16 votes), past polls