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

Re^2: Reading from a Named Pipe

by nzgrover (Scribe)
on Sep 28, 2006 at 21:28 UTC ( #575430=note: print w/replies, xml ) Need Help??


in reply to Re: Reading from a Named Pipe
in thread Reading from a Named Pipe

ah ha! So something like:
if (-p $named_pipe_name) { eval { local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required alarm $timeout; if (sysopen(FIFO, $named_pipe_name, O_RDONLY)) { while(my $this_line = <FIFO>) { chomp($this_line); $result .= $this_line; } close(FIFO); } else { $errormsg = "ERROR: Failed to open named pipe $named_pipe_name + for reading: $!"; } alarm 0; }; if ($@) { if ($@ eq "alarm\n") { # timed out $errormsg = "Timed out reading from named pipe $named_pipe_nam +e"; } else { $errormsg = "Error reading from named pipe: $!"; } } else { # didn't time out print STDOUT "$result\n"; } }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (6)
As of 2021-10-24 10:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (89 votes). Check out past polls.

    Notices?