Skip Menu |

This queue is for tickets about the MARC-Record CPAN distribution.

Report information
The Basics
Id: 88682
Status: resolved
Priority: 0/
Queue: MARC-Record

People
Owner: Nobody in particular
Requestors: jstephenson [...] mvlc.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 2.0.6



Subject: Enhancement to allow MARC::Field delete_subfield to match code on regexp
Date: Sat, 14 Sep 2013 12:45:41 -0400
To: bug-MARC-Record [...] rt.cpan.org
From: Jason Stephenson <jstephenson [...] mvlc.org>
While processing a batch of records from a new member or other third party vendor, it is helpful to get rid of crud. However, I found myself wanting to get rid of any subfields with invalid codes, regardless of their content. The MARC documentation says: "Data element identifiers are lowercase alphabetic or numeric characters." This was rather difficult to implement, since I would need to specify an array of every possible character but a-z and 0-9 for the delete_subfield call. I realized the fastest way to do this would be to write: $field->delete_subfield(code => qr/[^a-z0-9]/); The attached patch makes this possible and includes the new usage in the POD. I have attached a patch to add this behavior to MARC::Field. I also certify that I wrote the code myself and have every right to submit on behalf of myself and my employer. -- Jason Stephenson Assistant Director for Technology Services Merrimack Valley Library Consortium

Message body is not shown because sender requested not to inline it.

Subject: [rt.cpan.org #88682] Better version of the patch
Date: Sun, 15 Sep 2013 13:04:52 -0400
To: bug-MARC-Record [...] rt.cpan.org
From: Jason Stephenson <jstephenson [...] mvlc.org>
After thinking about it, and mentioning this bug to jcamins in #evergreen on irc.freenode.net, I decided to come up with a slightly better version of the patch. While the previous patch worked, it check the value twice if given a regexp and the regexp failed to match. This version only checks the value once if given a regexp. Same certification applies as before: I am the author of this code and have the right to submit it on behalf of myself and my employer. Also, jcamins says this would be really useful. ;) I have found it extremely useful, so far. -- Jason Stephenson Assistant Director for Technology Services Merrimack Valley Library Consortium

Message body is not shown because sender requested not to inline it.

On Sun Sep 15 13:05:07 2013, jstephenson@mvlc.org wrote: Show quoted text
> After thinking about it, and mentioning this bug to jcamins in > #evergreen on irc.freenode.net, I decided to come up with a slightly > better version of the patch. While the previous patch worked, it check > the value twice if given a regexp and the regexp failed to match. This > version only checks the value once if given a regexp.
Thanks. I've applied your patch and the new functionality is available as of MARC::Record 2.0.6.