[Koha-devel] RFC on ISBN sanitisations, was: [Koha-patches] [PATCH] Bugfix ShelfBrowser using unsanitized ISBNs. Owen reported the

Galen Charlton galen.charlton at liblime.com
Wed May 14 21:14:31 CEST 2008


Hi,

On Wed, May 14, 2008 at 1:59 PM, Jesse <pianohacker at gmail.com> wrote:
> Do you think we could also put standard formatting of these types of numbers
> in there, and make a naming scheme?
>
> Example:
>
> ISBNInternalForm('0-7434-3602-4') eq '0743436024'
>  ISBNDisplayForm('0743436024') eq '0-7434-3602-4'

I agree that some sort of naming convention is in order.  In addition
to internal (i.e., for search and API use) and display forms, an
additional type of normalization would be equivalent forms - I'm
thinking specifically of ISBN-10s and ISBN-13s.  Checkdigit and form
validation may also belong in such a model.

One possibility for naming:

use C4::Normalize qw/:ISBN/; # or use C4::Normalize::ISBN?

my $normed = display_isbn('0743436024'); # 0-7434-3602-4
$normed = display_isbn('0-7434-3602-4'); # 0-7434-3602-4, should be idempotent
$normed = search_isbn('0-7434-3602-4'); # 0743436024
$normed = search_isbn('0-7434-3602-4 (pbk.)'); # 0743436024; remove
cruft that we can use in search
my $ok = valid_isbn('foobar'); # false
my $isbn13 = isbn10_to_isbn13('0-7434-3602-4');

Alternatively, does an OO interface get us anything additional that is useful?

my $isbn = C4::Normalize::ISBN->new('0-7434-3602-4');
print $isbn->search();
print $isbn->display();

Regards,

Galen
-- 
Galen Charlton
Koha Application Developer
LibLime
galen.charlton at liblime.com
p: 1-888-564-2457 x709



More information about the Koha-devel mailing list