Edward Summers wrote:
On Apr 29, 2006, at 10:31 AM, Mark Jordan wrote:
Maybe other people should verify the usefulness of a delete subfield
function before anyone does anything about it, though. Would a half
dozen +1 votes from perl4libers validate its usefulness?
Yes it would...but to get the changes out on CPAN we'd all need to
convince Mike O'Regan who holds the keys to MARC-Record on CPAN. Right
now the version on CPAN is not the latest version that's available in
CVS on SourceForge. I think Mike has some performance concerns about the
Unicode handling code in v2.0, since MARC::Record is used in some of his
time critical applications. Hopefully we can benchmark v1.38 and v2.0
sometime and get the latest code pushed out to CPAN if things look OK.
Or if this is not an option there is always the possibility of creating
a MARC::Record2 on CPAN. That would be kind of ugly for backwards
compatibility though.
OK -- here's the call for a vote. All interested perl4lib members are
encouraged to participate by emailing the list.
Proposal: Incorporate the functions for deleting specific subfields into
MARC-Record v2.0, based on examples Ed supplies below.
Process: +1 = Yes for Proposal, anything else = No and must be
accompanied by reasons not to incorporate these features into v2.0.
Deadline: Midnight (Greenwich/UTC), Thursday May 4.
Mark
At any rate if you are open to using the latest/greatest code from
SourceForge there is nothing stopping us from getting a delete_subfield
method working.
$field->delete_subfield('a', 0);
In the interests of flexibility how about using hash key/value pairs?
Here's what I'm thinking:
# delete all subfield u
$field->delete_subfield(code => 'u');
# delete first two subfield u
$field->delete_subfield(code => 'u', count => 2);
# delete all subfield u that have 'zombo.com' in them
$field->delete_subfield(code => 'u', match = qr/zombo\.com/);
# delete only the first subfield u that has 'zombo.com' in it
$field->delete_subfield(code => 'u', match => qr/zombo\.com', count => 1);
# delete any subfield with a value that matches 'zombo.com'
$field->delete_subfield(match => qr/zombo\.com/);
So effectively there is AND boolean logic between any options that are
supplied. If this looks good I've got some code that does it and some
tests committed in SourceForge for you to take a look at [1]. I'm open
to suggestions on renaming parameters, etc... Here are the basics for
checking out the code if you haven't done it before.
cvs -d:pserver:[EMAIL PROTECTED]:/cvsroot/marcpm login
cvs -z3 -d:pserver:[EMAIL PROTECTED]:/cvsroot/marcpm co
-P marc-record
//Ed
[1] http://sourceforge.net/cvs/?group_id=1254