Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^3: Backticks and SIGALRM

by nemo (Sexton)
on Aug 20, 2007 at 11:51 UTC ( #633779=note: print w/ replies, xml ) Need Help??


in reply to Re^2: Backticks and SIGALRM
in thread Backticks and SIGALRM

Can I pipe the output of the system command to my own program and read it in line by line. That way getting the best of both?


Comment on Re^3: Backticks and SIGALRM
Replies are listed 'Best First'.
Re^4: Backticks and SIGALRM
by Anno (Deacon) on Aug 20, 2007 at 13:18 UTC
    Yes, you can pipe the output of the system command to [your] own program. In perldoc -f open, see the paragraphs following
    If the filename begins with '|' ...
    Anno
Re^4: Backticks and SIGALRM
by sgt (Chaplain) on Aug 20, 2007 at 13:34 UTC

    as you are using qx() (which gets the full output anyway) maybe you can simply redirect the output of your external command to a file (using the system shell and process that later

    my $cmd = "$ext_cmd > $my_output"; # using unixlike shell system($cmd) == 0 or die; #

    (ignore if your OS is not unixlike) what does happen if you manually send SIGALRM to that external process? (wrap it in a shell if the execution time is too short).

    cheers --stephan

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (18)
As of 2015-07-31 17:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (279 votes), past polls