Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: IPC::Run / bash pipe

by ag4ve (Monk)
on Nov 07, 2013 at 01:53 UTC ( #1061515=note: print w/ replies, xml ) Need Help??


in reply to Re: IPC::Run / bash pipe
in thread IPC::Run / bash pipe

This is the syntax I'm going for:

grep ba > t.txt 2>&1 <<< $(echo -e "foo\nbar\nbaz")

To demonstrate what I'm Looking at:

#!/usr/bin/env perl use strict; use warnings; use IPC::Run qw(run); my $str; my $count = 0; while (1) { $count += 10; $str .= "1111111111"; run [echo => $str], '|', [grep => 'foo']; print "$count " unless ($count % 10000) }

And if you don't feel like waiting for it, here's the result:

% ./t2.pl 10000 20000 30000 40000 50000 60000 70000 80000 90000 100000 110000 12 +0000 130000 exec failed: Argument list too long at ./t2.pl line 16. at ./t2.pl line 16.

If I don't use ipset (which are pretty long by their own, I'm under the limit. However, without ipset:

# wc -c fw2.save 165670 fw2.save

I don't want to write a tempfile unless there's no other option, ulimit -s unlimited doesn't seem to make a difference, and I'm not sure about FFI::Raw and iptc.o / iptables.o (I'm looking into it).


Comment on Re^2: IPC::Run / bash pipe
Select or Download Code
Re^3: IPC::Run / bash pipe
by ag4ve (Monk) on Nov 07, 2013 at 02:11 UTC

    Oh, nm, I'm blind (or not paying attention) - that works

    my $success = run [$ipt_cmd => 'iptables-restore'], '<', \(join("\n". @iptout)), '>', \my $cmdout, '2>&1';

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (10)
As of 2015-07-06 06:06 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 (70 votes), past polls