<div dir="ltr">If you're sure the problem is in the s///, replace it with index() and substr().</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jan 22, 2014 at 10:25 AM, Antonio Sun <span dir="ltr"><<a href="mailto:tpm.ats@spamgourmet.com" target="_blank">tpm.ats@spamgourmet.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 22, 2014 at 12:54 AM, Shlomi Fish wrote:<div class="im">
<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div>> > No luck, the matched string is actually one big base64 encoded string<br>
> > in only one line.<br>
><br>
</div>> So send it in one megabyte chunks.<br></blockquote><div> </div></div><div><span style="font-family:arial,sans-serif;font-size:13px">My </span><span style="color:rgb(80,0,80)">one line file is only </span><span style="font-family:arial,sans-serif;font-size:13px">238566 bytes in size. See OP for details.</span></div>
<div class="im">
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Yes, and one can use IPC::Run for that as I noted -<br>
<a href="https://metacpan.org/release/IPC-Run" target="_blank">https://metacpan.org/release/IPC-Run</a> - just open a process to accept its STDIN<br>
and pipe it to it, and then get its STDOUT.<br></blockquote></div></div><br>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:<br>
</div><div class="gmail_extra"><br></div><div class="gmail_extra"><span><span style="font-size:13px;font-family:Calibri;background-color:transparent;vertical-align:baseline;white-space:pre-wrap"> 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' </span></span><br>
</div><div class="gmail_extra"><br></div><div class="gmail_extra">And it just stops there forever, with or without the <span style="font-family:Calibri;font-size:13px;white-space:pre-wrap">waitpid. </span></div><div class="gmail_extra">
<br></div><div class="gmail_extra">The problem is the big s///g loop. Standalone IPC::Open2 read/write tested fine. </div><div class="gmail_extra"><br></div><div class="gmail_extra">Thanks for the input. </div><div class="gmail_extra">
<br></div></div>
<br>_______________________________________________<br>
toronto-pm mailing list<br>
<a href="mailto:toronto-pm@pm.org">toronto-pm@pm.org</a><br>
<a href="http://mail.pm.org/mailman/listinfo/toronto-pm" target="_blank">http://mail.pm.org/mailman/listinfo/toronto-pm</a><br>
<br></blockquote></div><br></div>