[tpm] sys call length limitation

Antonio Sun tpm.ats at spamgourmet.com
Wed Jan 22 07:25:48 PST 2014


On Wed, Jan 22, 2014 at 12:54 AM, Shlomi Fish wrote:

> > > No luck, the matched string is actually one big base64 encoded string
> > > in only one line.
> >
> > So send it in one megabyte chunks.
>

My one line file is only 238566 bytes in size. See OP for details.

Yes, and one can use IPC::Run for that as I noted -
> https://metacpan.org/release/IPC-Run - just open a process to accept its
> STDIN
> and pipe it to it, and then get its STDOUT.
>

For a process to accept STDIN and can get its STDOUT, the answer
is IPC::Open2, because it is in the standard distribution and IPC::Run is
not (Just learnt it myself when investigating the solution). Anyway, here
is my IPC::Open2 version:

perl -MFileHandle -MIPC::Open2 -n000e 'BEGIN { sub process { $pid =
open2(*Reader, *Writer, "cat | wc -c"); print Writer $_[0]; waitpid( $pid,
0 ); $got = <Reader>; }; }; s,(?<=">)(.*?)(?=</HttpBody>),process $1,eg;
print'

And it just stops there forever, with or without the waitpid.

The problem is the big s///g loop. Standalone IPC::Open2 read/write tested
fine.

Thanks for the input.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/toronto-pm/attachments/20140122/11464601/attachment.html>


More information about the toronto-pm mailing list