help with qx?
Iain Barnett
iainspeed at gmail.com
Wed Feb 6 13:42:53 GMT 2008
On 6 Feb 2008, at 7:11 am, Uri Guttman wrote:
>>>>>> "RJR" == Randy J Ray <rjray at blackperl.com> writes:
>
>>> and it will be unlikely that his command will generate enough
>>> output to
>>> fill a stdio buffer in the qx or the open pipe. so looping over
>>> the qx
>>> lines in a list context or reading line by line from the open
>>> pipe will
>>> be about the same speed and storage.
>
> RJR> He did specifically say that he expected the command to
> generate
> RJR> a considerable amount of output. I suppose that depends on
> RJR> whether his concept of "considerable" matches ours. Pulling
> large
> RJR> diffs or log history on a sizable project could produce fairly
> RJR> large output.
>
> if that is the case then open | will be more efficient. but with
> today's
> ram and buffer sizes, even 1Mb is small. we haven't been told the
> output
> size but if it is < 1MB (or even more given the ram available) then
> buffering will not matter much. so again, simpler coding should win
> out
> and qx is simpler than open |.
>
> uri
>
> --
> Uri Guttman ------ uri at stemsystems.com -------- http://
> www.sysarch.com --
> ----- Perl Architecture, Development, Training, Support, Code
> Review ------
> ----------- Search or Offer Perl Jobs ----- http://jobs.perl.org
> ---------
> --------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com
> ---------
I'm quite embarrassed to say it ended up being approx 250k... (gets
coat)
In my defence, the buffer on the Windows command terminal was so
small that I couldn't tell how much there was - it looked like a lot
more than that! :) Still, could be a lot more output depending on
what is checked out, but you're probably both right about the power
of the machines etc.
I ended up using a pipe because it still printed to STDOUT with a
filehandle. Once I got it working I just left it as is.
Iain
More information about the london.pm
mailing list