> However, the last line gets a "Arguments must be MARC::Field objects"
> error. I don't see anyplace in Example 17 where a MARC::Field object is
> built for the new 005 field, so I'm stumped.
> Suggestions, please.

Hi Anne. Thanks for noticing this error in the tutorial. 

You must pass append_fields() one or many MARC::Field objects. Try modifying 
your program like so:

    my $cont_006_flag = 0;
    my $cont_006 = MARC::Field->new( '006','sk  d s          2' );

    my @f006 = $record->field('006');
    if (@f006)
    {
            foreach my $t006 (@f006)
            {
                    if (substr($t006->as_string(),0,1) eq 's')
                            {$cont_006_flag = 1;}
            }
    }
        
    if ($cont_006_flag == 0) {$record->append_fields($cont_006);}

The only things I changed were the definition of $cont_006 on the second line to
create a MARC::Field object, and the use of append_fields() to pass in the
MARC::Field object. You might even want to use insert_grouped_field() if you 
would like the 006 put in the beginning of the record with the other control
fields.

Thanks again for noticing this typo.

//Ed

Reply via email to