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

Report information
The Basics
Id:
76451
Status:
new
Priority:
Low/Low
Queue:

People
Owner:
Nobody in particular
Requestors:
chris.cooke.ctr [...] nrl.navy.mil
Cc:
AdminCc:

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



Subject: Bug in MARC::Record
Date: Mon, 09 Apr 2012 14:46:55 -0400
To: <bug-MARC-Record@rt.cpan.org>
From: "Chris Cooke, Contractor, Code 5596" <chris.cooke.ctr@nrl.navy.mil>
There is a bug in MARC::Record when you use the form:

my $title = $marc->field('245')->subfield("a");

The problem is that if the field 245 is not defined, then you get a "Can't call method "subfield" on an undefined value at..." error.  I have just started to use this module, and noticed this right away on a record with an undefined isbn.  This problem does not seem to exist in the form:

my $title = $marc->subfield('245', "a");

In my program, 

$record{$isbn} = $marc->field('20')->subfield('a');

Crashes, but

 $record{$isbn} = $marc->subfield('20', 'a');

Is fine.

The documentation on CPAN states that these two methods are equivalent, but they are not.

-Chris


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

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.