RE: Deleting a subfield using MARC::Record

[email protected] (Bryan Baldus)
Newsgroups perl.perl4lib
Message-ID <1F95E99A11EFA541B0BDE754166A8F70C73702@qbiex.qbi.quality-books.com>
On Monday, May 01, 2006 1:24 PM, Brad Baxter wrote:
>On 4/30/06, Edward Summers <[email protected]> wrote:
>[snip]
>> # delete first two subfield u
>> $field->delete_subfield(code => 'u', count => 2);
>
>I don't think I like it this way.  How would you delete just 
>the second one?
>I'd rather see 'count' mean 'occurrence', so the above would mean
>delete the second subfield u.  And ...
>
># delete second and third subfield u
>$field->delete_subfield(code => 'u', count => 2, count => 3);
>

When I looked at it, I also wondered about 'count' being 'position' or
something like that, to be able to note which occurrence. It might be useful
to have both--if you know it is always the 1st 2 occurrences of the
subfields, use 'count', but if you know it is the 1st and 3rd, then use
'position' or 'occurrence'.

examples:
#remove 1st 2 subfield 'u'
$field->delete_subfield(code => 'u', count => 2);

#remove 1st and 3rd subfield 'u'
$field->delete_subfield(code => 'u', occurence => (0, 2)); #or (1, 3)

#remove last subfield u
$field->delete_subfield(code => 'u', occurence => (-1));

--

Bryan Baldus
[email protected]
[email protected]
http://home.inwave.com/eija
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.