Changeset 652

Show
Ignore:
Timestamp:
05/20/02 12:19:08
Author:
miyagawa
Message:

0.02

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • IDNA-Punycode/trunk/Changes

    r639 r652  
    11Revision history for Perl extension IDNA::Punycode 
     2 
     30.02  Mon May 20 12:17:26 JST 2002 
     4        * [API change] now exception is thrown in conversion failure 
    25 
    360.01  Tue May  7 11:47:28 2002 
  • IDNA-Punycode/trunk/lib/IDNA/Punycode.pm

    r639 r652  
    22 
    33use strict; 
    4 our $VERSION = 0.01
     4our $VERSION = 0.02
    55 
    66require Exporter; 
     
    99 
    1010use integer; 
    11  
    12 our $ERROR = ''; 
    13 sub _err { $ERROR = shift; return } 
    1411 
    1512our $DEBUG = 0; 
     
    2522my $Delimiter = chr 0x2D; 
    2623my $BasicRE   = qr/[\x00-\x7f]/; 
     24 
     25sub _croak { require Carp; Carp::croak(@_); } 
    2726 
    2827sub digit_value { 
     
    6362    if ($code =~ s/(.*)$Delimiter//o) { 
    6463        push @output, map ord, split //, $1; 
    65         return _err('non-basic code point') unless $1 =~ /^$BasicRE*$/o; 
     64        return _croak('non-basic code point') unless $1 =~ /^$BasicRE*$/o; 
    6665    } 
    6766 
     
    7372            my $cp = substr($code, 0, 1, ''); 
    7473            my $digit = digit_value($cp); 
    75             defined $digit or return _err("invalid punycode input"); 
     74            defined $digit or return _croak("invalid punycode input"); 
    7675            $i += $digit * $w; 
    7776            my $t = ($k <= $bias) ? TMIN 
     
    186185=back 
    187186 
    188 These functions return undef on failure. You can get error reason via 
    189 variable C<$IDNA::Punycode::ERROR>. 
     187These functions throws exceptionsn on failure. You can catch 'em via 
     188C<eval>. 
    190189 
    191190=head1 AUTHOR