(By MARC.pm, I believe you mean the MARC::Record distribution of modules).

At 6:09 PM -0700 4/14/08, Migell Acosta wrote:
So, I need to do pattern matching, I think from the docs I'm supposed to do it like this: if($phys_format->as_string() =~ /Paperback/ ). I think I need the "as_string" in order to do regular expressions, yes?

However, what I get back from the interpreter is "Can't locate object method 'as_string' via package Paperback (perhaps you forgot to load Paperback)?"

According to the POD of MARC::Field, at "subfield(code)"

"When called in a scalar context returns the text from the first subfield matching the subfield code."

So, in "my $phys_format = $field->subfield('c');", $phys_format contains the text of subfield c, rather than a Perl object. Instead of:

if($phys_format->as_string() =~ /Paperback/ ){

(which, according to the error, is the same as saying "if(Paperback->as_string() =~ /Paperback/){")

This:

if($phys_format =~ /Paperback/ ){

should work.

The as_string method is used for entire MARC::Field objects (whole fields, with optional filtering to include only some of the subfields).

###################


I hope this helps,

Bryan Baldus
[EMAIL PROTECTED]
[EMAIL PROTECTED]
http://home.inwave.com/eija

Reply via email to