Re: perl wrapper for yaz-marcdump

From: Joe Hourcle <oneiros_at_nyob>
Date: Fri, 30 Jan 2009 16:44:57 -0500
To: CODE4LIB_at_LISTSERV.ND.EDU
On Fri, 30 Jan 2009, Eric Lease Morgan wrote:

> Is there any way I can make my Perl wrapper for yaz-marcdump, below, more
> efficient?

[trimmed]

> For extra credit, is there anyway I can optimize m2u? For example, is there
> anyway to get rid of the while loop and slurp up yaz-marcdump's output in
> one go?

It might be faster to process multiple files at once, so you don't have 
the overhead of perl starting up each time.  For the while loop, use:

 	my $r = do { local $/ = undef; <C> };


(unset the end-of line marker, then read it in one pass, the 'do' block 
keeps the change of end of line marker from affecting anything else)


-Joe
Received on Fri Jan 30 2009 - 16:45:54 EST