On Friday, November 14, 2003, at 09:40 AM, Bryan Baldus wrote:

I turned "strict_off", to get through the entire file, but
the exported records have had "Invalid indicators forced to blanks." I would
like to get these records, and any others that generate errors, and save
them (as originally read) to a separate file, in order to correct the
errors. Since I don't fully understand Perl,

Who does? :-)


my solution was to modify
MARC::File, by adding a method, "skipget()", based on the existing "skip()",
but returning $rec : undef, instead of 1 : undef. My understanding is that
this should return the raw, unchanged marc string from the original file.

Just FYI, you can modify MARC::File without modifying MARC/File.pm itself. The trick is simply to use a fully qualified name when defining the new MARC::File method:


    #!/usr/bin/perl -w
    use strict;
    $| = 1;
    use MARC::File;
    sub MARC::File::skipget {
        ... your code here ...
    }
    ... the rest of your script here ...

Better yet, since skipget() might end up in MARC::File some day, you can do this:

    if (UNIVERSAL::can('MARC::File', 'skipget')) {
        warn "Edit this script--MARC::File now has a skipget() method";
    } else {
        *MARC::File::skipget = sub {
            ... your code here ...
        };
    }

These tricks sometimes come in handy.

Paul.

--
Paul Hoffman :: Taubman Medical Library :: Univ. of Michigan
[EMAIL PROTECTED] :: [EMAIL PROTECTED] :: http://www.nkuitse.com/



Reply via email to