Changeset 322

Show
Ignore:
Timestamp:
10/31/01 07:19:22
Author:
miyagawa
Message:

0.02

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Net-IDN-Nameprep/trunk/Changes

    r319 r322  
    11Revision history for Perl extension Net::IDN::Nameprep. 
     2 
     30.02  Wed Oct 31 07:18:02 JST 2001 
     4        - Fixed bug which mapping returns multiple character 
     5        - Added more tests 
    26 
    370.01  Wed Oct 31 04:43:12 2001 
  • Net-IDN-Nameprep/trunk/Makefile.PL

    r319 r322  
    77    'PREREQ_PM' => { 
    88        Unicode::Normalize => 0, 
     9        Test::More => 0.18, 
    910    }, 
    1011); 
  • Net-IDN-Nameprep/trunk/lib/Net/IDN/Nameprep.pm

    r319 r322  
    33use strict; 
    44require v5.6.0; 
    5 our $VERSION = '0.01'; 
     5our $VERSION = '0.02'; 
    66our @ISA    = qw(Exporter); 
    77our @EXPORT = qw(nameprep); 
     
    1717    for my $i (0..length($input)-1) { 
    1818        my $char = substr($input, $i, 1); 
    19         $mapped .= chr(Net::IDN::Nameprep::Mapping->mapping(ord($char))); 
     19        $mapped .= join '', map chr, Net::IDN::Nameprep::Mapping->mapping(ord($char)); 
    2020    } 
    2121    return $mapped; 
     
    2828        if (Net::IDN::Nameprep::Prohibited->prohibited(ord($char))) { 
    2929            require Carp; 
    30             Carp::croak("String $input contains prohibited character: $char"); 
     30            Carp::croak("String contains prohibited character: U+". sprintf '%04x', ord $char); 
    3131        } 
    3232    } 
  • Net-IDN-Nameprep/trunk/t/03_nameprep.t

    r319 r322  
    22use Test::More 'no_plan'; 
    33 
    4 use Unicode::String; 
    54use Net::IDN::Nameprep; 
    65 
    76my(@from, @to); 
    8  
    97push @from, [ qw(012d 0111 014b) ]; push @to, [ qw(012d 0111 014b) ]; 
     8push @from, [ qw(304b 3099 ff21) ]; push @to, [ qw(304c 0061) ]; 
    109 
    1110for my $i (0..$#from) { 
     
    1413    is nameprep($in), $out, "$in -> $out"; 
    1514} 
     15 
     16my @prohibited; 
     17push @prohibited, [ qw(012d 0040) ]; 
     18 
     19for my $p (@prohibited) { 
     20    my $in = join '', map { chr hex $_ } @{$p}; 
     21    eval { nameprep $in }; 
     22    ok $@, $@; 
     23} 
     24