From chris.cooke.ctr@nrl.navy.mil Mon Apr 9 16: | 35:35 2012 |
MIME-Version: | 1.0 |
X-CCS-Mailscanner: | No viruses found. |
X-Spam-Status: | No, score=-1.898 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, HTML_MESSAGE=0.001, MIME_QP_LONG_LINE=0.001] autolearn=ham |
X-Spam-Flag: | NO |
X-Virus-Checked: | Checked by ClamAV on 16.mx.develooper.com |
Content-Type: | multipart/alternative; boundary="B_3416834127_249466123" |
Message-ID: | <CBA8C044.1447C%chris.cooke.ctr@nrl.navy.mil> |
X-Virus-Scanned: | Debian amavisd-new at bestpractical.com |
X-Spam-Score: | -1.898 |
Received: | from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 16F2A2401BF for <cpan-bug+MARC-Record@hipster.bestpractical.com>; Mon, 9 Apr 2012 16:35:35 -0400 (EDT) |
Received: | from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kMjhJU263thW for <cpan-bug+MARC-Record@hipster.bestpractical.com>; Mon, 9 Apr 2012 16:35:33 -0400 (EDT) |
Received: | from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 0D90C24002A for <bug-MARC-Record@rt.cpan.org>; Mon, 9 Apr 2012 16:35:32 -0400 (EDT) |
Received: | (qmail 3531 invoked by uid 103); 9 Apr 2012 20:35:32 -0000 |
Received: | from x16.dev (10.0.100.26) by x1.dev with QMQP; 9 Apr 2012 20:35:32 -0000 |
Received: | from ccslinux.ccs.nrl.navy.mil (HELO ccslinux.ccs.nrl.navy.mil) (132.250.118.49) by 16.mx.develooper.com (qpsmtpd/0.80/v0.80-19-gf52d165) with ESMTP; Mon, 09 Apr 2012 13:35:28 -0700 |
Received: | from [132.250.186.65] (lib-065.nrl.navy.mil [132.250.186.65]) by ccslinux.ccs.nrl.navy.mil (8.13.8/8.13.8) with ESMTP id q39KZDHk027259 for <bug-MARC-Record@rt.cpan.org>; Mon, 9 Apr 2012 16:35:21 -0400 |
X-CCS-Mailscanner-Info: | See: http://www.nrl.navy.mil/ccs/support/email |
Delivered-To: | cpan-bug+MARC-Record@hipster.bestpractical.com |
User-Agent: | Microsoft-MacOutlook/14.14.0.111121 |
Subject: | Multiple values bug in subfield function for MARC::Record |
Return-Path: | <chris.cooke.ctr@nrl.navy.mil> |
X-RT-Mail-Extension: | marc-record |
X-Original-To: | cpan-bug+MARC-Record@hipster.bestpractical.com |
X-Spam-Check-BY: | 16.mx.develooper.com |
Date: | Mon, 09 Apr 2012 16:35:16 -0400 |
X-Spam-Level: | |
Thread-Topic: | Multiple values bug in subfield function for MARC::Record |
To: | Bugs in MARC-Record via RT <bug-MARC-Record@rt.cpan.org> |
From: | "Chris Cooke, Contractor, Code 5596" <chris.cooke.ctr@nrl.navy.mil> |
Content-Length: | 0 |
content-type: | text/plain; charset="utf-8" |
Content-Transfer-Encoding: | 7bit |
X-RT-Original-Encoding: | US-ASCII |
Content-Length: | 1078 |
content-type: | text/html; charset="utf-8" |
Content-Transfer-Encoding: | quoted-printable |
X-RT-Original-Encoding: | US-ASCII |
Content-Length: | 1759 |
There is a bug in MARC::Record when you have multiple values for a field, such as mutliple ISBNs (field 020). The subfield function only returns the first value, even in an array context. But the field function correctly returns an array.
I parsed a file using MARC::File::USMARC, and then for a sample record, did this code:
print "subfield test\n";
@isbns = $marc->subfield('020', 'a');
foreach my $isbn (@isbns) {
print " isbn from subfield function: $isbn\n";
}
print " there were " . scalar(@isbns) . " isbns from subfield function\n";
print "field test\n";
@isbns = $marc->field('020');
foreach my $isbn (@isbns) {
print " isbn from field function: " . $isbn->subfield('a') . "\n";
}
And it printed this result:
subfield test
isbn from subfield function: 9781574443066
there were 1 isbns from subfield function
field test
isbn from field function: 9781574443066
isbn from field function: 1574443062 (alk. paper)
there were 2 isbns from field function
As you can see, the subfield function threw away my second ISBN.
-Chris