This queue is for tickets about the MARC-Record CPAN distribution.

Report information
The Basics

Nobody in particular
chris.cooke.ctr [...]

(no value)
Broken in:
(no value)
Fixed in:
(no value)

From 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
Content-Type: multipart/alternative; boundary="B_3416834127_249466123"
Message-ID: <>
X-Virus-Scanned: Debian amavisd-new at
X-Spam-Score: -1.898
Received: from localhost (localhost []) by (Postfix) with ESMTP id 16F2A2401BF for <>; Mon, 9 Apr 2012 16:35:35 -0400 (EDT)
Received: from ([]) by localhost ( []) (amavisd-new, port 10024) with ESMTP id kMjhJU263thW for <>; Mon, 9 Apr 2012 16:35:33 -0400 (EDT)
Received: from ( []) by (Postfix) with SMTP id 0D90C24002A for <>; 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 ( by with QMQP; 9 Apr 2012 20:35:32 -0000
Received: from (HELO ( by (qpsmtpd/0.80/v0.80-19-gf52d165) with ESMTP; Mon, 09 Apr 2012 13:35:28 -0700
Received: from [] ( []) by (8.13.8/8.13.8) with ESMTP id q39KZDHk027259 for <>; Mon, 9 Apr 2012 16:35:21 -0400
X-CCS-Mailscanner-Info: See:
User-Agent: Microsoft-MacOutlook/
Subject: Multiple values bug in subfield function for MARC::Record
Return-Path: <>
X-RT-Mail-Extension: marc-record
Date: Mon, 09 Apr 2012 16:35:16 -0400
Thread-Topic: Multiple values bug in subfield function for MARC::Record
To: Bugs in MARC-Record via RT <>
From: "Chris Cooke, Contractor, Code 5596" <>
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.


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

Please report any issues with to