Hi,

On Wed, May 14, 2008 at 1:59 PM, Jesse <[EMAIL PROTECTED]> 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
[EMAIL PROTECTED]
p: 1-888-564-2457 x709
_______________________________________________
Koha-devel mailing list
Koha-devel@lists.koha.org
http://lists.koha.org/mailman/listinfo/koha-devel

Reply via email to