Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: portability / system / elegance

by ikegami (Patriarch)
on Dec 05, 2016 at 01:40 UTC ( [id://1177186]=note: print w/replies, xml ) Need Help??


in reply to portability / system / elegance

Avoid the shell. In addition to the usual benefits, this problem goes away.

You should use IPC::Run3 or IPC::Run, but low-level IPC::Open3 will be easy enough to use here.

use File::Spec::Functions qw( devnull ); use IPC::Open3 qw( open3 ); { my @cmd = ( $tshark_binary => ( -r => $pcap, -e => "frame.number", -e => "frame.time_epoch", -e => "ip.src", -e => "ip.id", -T => "text", -T => "fields", -E => "separator=," ), ); open(local *CHILD_STDIN, '<', devnull) or die $!; open(local *CHILD_STDOUT, '>', $file_temp) or die $!; my $pid = open3('<&CHILD_STDIN', '>&CHILD_STDOUT', '>&STDERR', @cmd); waitpid($pid, 0); }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-04-19 04:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found