🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.perl.misc
Article #262

Re: Most efficient method to call a system routine and capture it's output

#262
From: Ralph SOBEK
Date: Fri, 19 Jul 2002 15:00
58 lines
3844 bytes
Hi Folks,

	Since I have not seen any followups or received any e-mail,
probably due to everyone being already on vacation, I add here my
latest experimentation.

	What is the most efficient method to call a system routine
repeatedly and capture it's short output?

	Supposedly, in loop:

#1	system @cmd;

is efficient.  But using backquotes:

#2	(my $sum = `@cmd 2>/dev/null`) =~ s/\s+.*$//;

captures the output correctly, but is horrendously slow, if repeated a
couple of thousand times.  For 35,000 files count about SIX hours!

	Is there a possibility to prepare the fork in #1 in such a way
as to recover the forks output afterwards?  It may help to know that
the output consists only of two numbers.

	In fact, in the above I am using File::Find to recursively
checksum a file structure.  @cmd[0] = '/usr/ucb/sum' and @cmd[1] is
the file path.

	Furthermore, in #2 there is the additional problem that the
shell causes with unusual file names.

	Any suggestions?

	Please do not reply directly to this posting, but use the
addresses below in my signature.  This is to thwart those mean SPAMmers!

	Please reply by e-mail, if at all possible, and I will
summarize to the net if interest warrants.

-- 
Dr. Ralph P. Sobek		  Disclaimer: The above ruminations are my own.
Ralph.Sobek @ irit.fr	          Wi-Fi:  http://www.irit.fr/~Ralph.Sobek/wifi/
sobek @ irit.fr                                           http://www.sobek.org/
Ph:(+33)[0]561556356   FAX:(+33)[0]561556847   http://www.irit.fr/~Ralph.Sobek/
===============================================================================
Estimates are that one-third to two-thirds of animal and plant species will 
disappear in foreseeable future!  AWFUL!
  SPAMMERS Beware: http://www.irit.fr/~Ralph.Sobek/welcome.shtml#Mail-Warning

-- 
Dr. Ralph P. Sobek		  Disclaimer: The above ruminations are my own.
Ralph.Sobek @ irit.fr	          Wi-Fi:  http://www.irit.fr/~Ralph.Sobek/wifi/
sobek @ irit.fr                                           http://www.sobek.org/
Ph:(+33)[0]561556356   FAX:(+33)[0]561556847   http://www.irit.fr/~Ralph.Sobek/
===============================================================================
Estimates are that one-third to two-thirds of animal and plant species will 
disappear in foreseeable future!  AWFUL!
  SPAMMERS Beware: http://www.irit.fr/~Ralph.Sobek/welcome.shtml#Mail-Warning
Technical Details
Message-ID: <aud6tjbw4d.fsf@irit.irit.fr>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!opentransit.net!jussieu.fr!unilim.fr!news.cict.fr!not-for-mail
References: <ausn2ib8ny.fsf@irit.irit.fr>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fa0ae,4cb838d93b34e411
X-Google-Attributes: gidfa0ae,public
X-Google-Thread: 112333,d48ce9f80ca98172,start
X-Google-Attributes: gid112333,public
X-Google-ArrivalTime: 2002-07-19 08:00:53 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!opentransit.net!jussieu.fr!unilim.fr!news.cict.fr!not-for-mail
From: Ralph SOBEK <sobek@iritRemoveSPAM.fr>
Newsgroups: comp.lang.perl.misc,fr.comp.lang.perl
Subject: Re: Most efficient method to call a system routine and capture it's output
Date: 19 Jul 2002 17:00:50 +0200
Organization: IRIT (CNRS), Toulouse, France
Lines: 58
Message-ID: <aud6tjbw4d.fsf@irit.irit.fr>
References: <ausn2ib8ny.fsf@irit.irit.fr>
NNTP-Posting-Host: poseidon.irit.fr
X-Trace: news.cict.fr 1027090851 3424 141.115.8.54 (19 Jul 2002 15:00:51 GMT)
X-Complaints-To: postmaster@cict.fr
NNTP-Posting-Date: 19 Jul 2002 15:00:51 GMT
X-Phone: (+33) [0]5 61 55 63 56
X-Url: http://www.irit.fr/~Ralph.Sobek/
X-Face: %sVWVa[L1"Elmkty#i(m7G_}sf2>i@utHeGc>ufDY@'#000+D|"T=r`0"!Oqr:tkcC*f*3c
 'f8jE/JkE!B*ny;_^`m:Fw%Xwg`81CcXh7jC)AXSMWl';^J%*RxNR;UMD/c0P~5hhcm*=I@k-XB2qk
 6i:wLHi6?VjUIj2L1@o*NH>JiOja82rj/\srQ4c`%$xe0R|m!O&T<5C+dL[z\XLJ4VpUBsFF$G2QQ4
 ?lTt.[[.O3;$$(-P?278p}m9qm:
X-Newsreader: Gnus v5.7/Emacs 19.34