Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

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

Velusamy R.

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

Replies are listed 'Best First'.
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?

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (5)
As of 2020-10-24 03:48 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (242 votes). Check out past polls.