On 4/13/07, Paul POULAIN <[EMAIL PROTECTED]> wrote:
Mike Rylander a écrit :
> On 4/13/07, Joshua M. Ferraro <[EMAIL PROTECTED]> wrote:
>  $parser->{ Handler }{ toMARC8 } = (lc($format) =~ /^unimarc/o || (
> $enc && lc($enc) =~ /^utf-?8$/o )) ? 0 : 1;
>

mmm... I agree with you.
In fact, I think having a test that, if true make 0 as result and if
false make 1 is confusing me. The good test is :
"do nothing if we have :
- UNIMARC (that is latin1 or utf8, never marc8)
OR
- marc21 and encoding set to utf8

don't you have something in marc21 to specify marc8 ?
we could simplify the test to something like :
parser->{ Handler }{ toMARC8 } =($enc && lc($enc) eq 'marc8')?1:0;

that would be much more readable


I agree.  I've been considering just moving that to its own sub for
clarity, so I'll just go ahead and refactor it now...

 $parser->{ Handler }{ toMARC8 } = (lc($format) =~ /^unimarc/o || (
$enc && lc($enc) =~ /^utf-?8$/o )) ? 0 : 1;

becomes

 $parser->{ Handler }{ toMARC8 } = decideMARC8Binary($format,$enc);
   ...

sub decideMARC8Binary {
       my $format = shift;
       my $enc = shift;

       return 0 if (defined($format) && lc($format) =~ /^unimarc/o);
       return 0 if (defined($enc) && lc($enc) =~ /^utf-?8/o);
       return 1;
}

CVS is updated with that now, and after anyone willing makes sure it's
not breaking anything I think we should release again.


> On a related note, there are several other changes intended improve
> support for UNIMARC authority records.  IIRC, I asked Paul to test
> this, but it's been very hectic recently and I don't recall if he
> responded to me or not.

I've been quite overloaded on the last 2 months (a new boy, thanks to my
beloved wife...),
  and don't remember the question, so can't say if I answered :-(


No problem, and congratulations!  Baby > Code any day. :)

--
Paul POULAIN et Henri Damien LAURENT
Consultants indépendants en logiciels libres et bibliothéconomie
(http://www.koha-fr.org)
Tel : 04 91 31 45 19



--
Mike Rylander
[EMAIL PROTECTED]
GPLS -- PINES Development
Database Developer
http://open-ils.org

Reply via email to