[Koha-devel] RFC on sanitisations

Henri-Damien LAURENT laurenthdl at alinto.com
Wed May 14 21:41:21 CEST 2008


Galen Charlton a écrit :
> Hi,
>
>   
Hi,
I also think this could be a good thing to have a C4::Normalize. (Maybe
not for 3.0)
Maybe we could broaden the scope.
UTF8 Normalize,
Normalizing publication dates and acquisition dates, and prices, and
maybe even itemcallnumber could also enter this module.

> 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()
I am not really going in for that.
Having pieces written in OO and others in procedural mode is not really
good for me.
Unless we get into a work of rewriting the code into OO Programming,
which would be a HUGE work, maybe highly valuable but I think that
having too many objects without good documentation and entry points
would really be a waste of time and strength.
Let's have this release out and document features and functions.
Then time for OO Programming will come at his own pace.
-- 
Henri-Damien LAURENT



More information about the Koha-devel mailing list