On Mon, Mar 12, 2012 at 01:49:36PM +0000, Anne Highsmith wrote:
> 
> Can anybody think of any reason why I shouldn't just use " my $new_marc = 
> $bib_rec->as_usmarc();". And if you can, can you suggest an alternative way 
> to correctly turn the object into a string?
> 
No thats the way the interface should work.
I think your use of sprintf
is mistaken. sprintf takes a format string and a list of variables and
formats the variables according to the format string. Use of sprintf and
printf is often a danger sign if they turn up in perl code.
What your code was doing was using the string returned by the ->as_usmarc
method and using that to format an empty list of variables, as soon as
'%' cropped up in a record the fact that the list was empty became a
problem. 

Your only potential problems with the marc string are if you want to
pass it to some interface that will get upset at MARC's embedded control
characters or the character set used in the record. But I suspect thats
not a problem because sprintf would not have changed that.

Colin

-- 
Colin Campbell
Chief Software Engineer,
PTFS Europe Limited
Content Management and Library Solutions
+44 (0) 800 756 6803 (phone)
+44 (0) 7759 633626  (mobile)
colin.campb...@ptfs-europe.com
skype: colin_campbell2

http://www.ptfs-europe.com

Reply via email to