Changeset 35518 for lang/perl

Show
Ignore:
Timestamp:
10/07/09 20:44:39 (5 years ago)
Author:
dankogai
Message:

VERSION 0.06

Location:
lang/perl/URI-Escape-XS/trunk
Files:
1 added
7 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/URI-Escape-XS/trunk/Changes

    r31519 r35518  
    11# 
    2 # $Id: Changes,v 0.5 2009/03/24 14:24:09 dankogai Exp dankogai $ 
     2# $Id: Changes,v 0.6 2009/10/07 11:40:30 dankogai Exp dankogai $ 
    33# 
    44# Revision history for Revision history for URI-Escape-XS 
    55# 
    6 $Revision: 0.5 $ $Date: 2009/03/24 14:24:09 $ 
     6$Revision: 0.6 $ $Date: 2009/10/07 11:40:30 $ 
     7+ t/05-null.t 
     8! XS.xs lib/URI/Escape/XS.pm 
     9  Addressed: 
     10  #45392: First invocation of encodeURIComponentIDN loses the path 
     11  #49375: decodeURIComponent() influences references from a regexp 
     12  #45855: Problems with undef 
     13  http://rt.cpan.org/Public/Bug/Display.html?id=45392 
     14  http://rt.cpan.org/Public/Bug/Display.html?id=49375 
     15  http://rt.cpan.org/Public/Bug/Display.html?id=45855 
     16 
     170.05 2009/03/24 14:24:09 
    718! lib/URI/Escape/XS.pm t/04-IDN.t 
    819  Now you can also use Net::LibIDN instead of Net::IDN::Encode 
  • lang/perl/URI-Escape-XS/trunk/MANIFEST

    r28505 r35518  
    1111t/03-hashu.t  
    1212t/04-idn.t 
     13t/05-null.t 
    1314t/boilerplate.t 
    1415t/pod-coverage.t 
  • lang/perl/URI-Escape-XS/trunk/README

    r31519 r35518  
    33 
    44VERSION 
    5     $Id: README,v 0.4 2009/03/24 14:24:09 dankogai Exp dankogai $ 
     5    $Id: README,v 0.4 2009/03/24 14:24:09 dankogai Exp $ 
    66 
    77SYNOPSIS 
  • lang/perl/URI-Escape-XS/trunk/XS.xs

    r28506 r35518  
    11/* 
    2  * $Id: XS.xs,v 0.3 2009/01/16 06:38:52 dankogai Exp $ 
     2 * $Id: XS.xs,v 0.4 2009/10/07 11:40:30 dankogai Exp dankogai $ 
    33 */ 
    44 
     
    3636}; 
    3737 
    38 SV *encode_uri_component(SV *str){ 
    39     int slen   = SvCUR(str); 
    40     int dlen   = 0; 
    41     SV *result = newSV(slen * 3 + 1); /* at most 3 times */ 
     38SV *encode_uri_component(SV *sstr){ 
     39    SV *str, *result; 
     40    int slen, dlen; 
    4241    U8 *src, *dst; 
    4342    int i; 
     43    if (sstr == &PL_sv_undef) return newSV(0); 
     44    str    = newSVsv(sstr);  /* make a copy to make func($1) work */ 
     45    slen   = SvPOK(str) ? SvCUR(str) : 0; 
     46    dlen   = 0; 
     47    result = newSV(slen * 3 + 1); /* at most 3 times */ 
    4448 
    4549    SvPOK_on(result); 
     
    6165} 
    6266 
    63 SV *decode_uri_component(SV *uri){ 
    64     int slen = SvCUR(uri); 
    65     int dlen = 0; 
    66     SV *result = newSV(slen + 1); 
     67SV *decode_uri_component(SV *suri){ 
     68    SV *uri, *result; 
     69    int slen, dlen; 
    6770    U8 buf[8], *dst, *src, *bp; 
    6871    int i, hi, lo; 
     72    if (suri == &PL_sv_undef) return newSV(0); 
     73    /* if (!SvPOK(suri)) return newSV(0); */ 
     74    uri  = newSVsv(suri);  /* make a copy to make func($1) work */ 
     75    slen = SvPOK(uri) ? SvCUR(uri) : 0; 
     76    dlen = 0; 
     77    result = newSV(slen + 1); 
    6978    
    7079    SvPOK_on(result); 
  • lang/perl/URI-Escape-XS/trunk/lib/URI/Escape/XS.pm

    r31519 r35518  
    11package URI::Escape::XS; 
    22# 
    3 # $Id: XS.pm,v 0.5 2009/03/24 14:24:09 dankogai Exp dankogai $ 
     3# $Id: XS.pm,v 0.6 2009/10/07 11:40:11 dankogai Exp $ 
    44# 
    55use 5.008001; 
    66use warnings; 
    77use strict; 
    8 our $VERSION = sprintf "%d.%02d", q$Revision: 0.5 $ =~ /(\d+)/g; 
     8our $VERSION = sprintf "%d.%02d", q$Revision: 0.6 $ =~ /(\d+)/g; 
    99 
    1010use base qw(Exporter); 
     
    119119=head1 VERSION 
    120120 
    121 $Id: XS.pm,v 0.5 2009/03/24 14:24:09 dankogai Exp dankogai $ 
     121$Id: XS.pm,v 0.6 2009/10/07 11:40:11 dankogai Exp $ 
    122122 
    123123=cut 
  • lang/perl/URI-Escape-XS/trunk/t/01-compat.t

    r31519 r35518  
    11#!perl -w 
    22# 
    3 # $Id: 01-compat.t,v 0.2 2009/03/24 14:24:09 dankogai Exp dankogai $ 
     3# $Id: 01-compat.t,v 0.2 2009/03/24 14:24:09 dankogai Exp $ 
    44# 
    55# Original as URI-1.35/t/escape.t 
  • lang/perl/URI-Escape-XS/trunk/t/04-idn.t

    r31519 r35518  
    11#!perl -w 
    22# 
    3 # $Id: 04-idn.t,v 1.2 2009/03/24 14:24:09 dankogai Exp dankogai $ 
     3# $Id: 04-idn.t,v 1.3 2009/10/07 11:40:30 dankogai Exp dankogai $ 
    44# 
    55# Original as URI-1.35/t/escape.t 
     
    77 
    88use URI::Escape::XS; 
    9 use Test::More tests => 6; 
     9use Test::More tests => 8; 
    1010 
    1111SKIP: { 
     
    1313    eval      { require Net::LibIDN } 
    1414      or eval { require Net::IDN::Encode } 
    15       or skip 'Net::LibIDN or Net::IDN::Encode required', 6; 
    16     my $d = 'http://ドメイン名例.jp/dankogai/だん/ダン'; 
    17     my $e = 
    18 'http:%2F%2Fxn--eckwd4c7cu47r2wf.jp%2Fdankogai%2F%E3%81%A0%E3%82%93%2F%E3%83%80%E3%83%B3'; 
     15      or skip 'Net::LibIDN or Net::IDN::Encode required', 8; 
     16 
     17    my $d = 'http://cnn.com/news'; 
     18    my $e = 'http:%2F%2Fcnn.com%2Fnews'; 
     19    is encodeURIComponentIDN($d) => $e, 'first encodeURIComponentIDN must preserve the path'; 
     20 
     21    $d = 'http://cnn.com/news'; 
     22    $e = 'http:%2F%2Fcnn.com%2Fnews'; 
     23    is encodeURIComponentIDN($d) => $e, 'second encodeURIComponentIDN must preserve the path as well'; 
     24 
     25    $d = 'http://ドメイン名例.jp/dankogai/だん/ダン'; 
     26    $e = 'http:%2F%2Fxn--eckwd4c7cu47r2wf.jp%2Fdankogai%2F%E3%81%A0%E3%82%93%2F%E3%83%80%E3%83%B3'; 
    1927    is decodeURIComponentIDN($e) => $d, 'decodeURIComponentIDN'; 
    2028    is encodeURIComponentIDN($d) => $e, 'encodeURIComponentIDN'; 
    2129    $d = 'http://ドメイン名例.JP:8080/dankogai/だん/ダン'; 
    22     $e = 
    23 'http:%2F%2Fxn--eckwd4c7cu47r2wf.JP:8080%2Fdankogai%2F%E3%81%A0%E3%82%93%2F%E3%83%80%E3%83%B3'; 
     30    $e = 'http:%2F%2Fxn--eckwd4c7cu47r2wf.JP:8080%2Fdankogai%2F%E3%81%A0%E3%82%93%2F%E3%83%80%E3%83%B3'; 
    2431    is decodeURIComponentIDN($e) => $d, 'decodeURIComponentIDN'; 
    2532    is encodeURIComponentIDN($d) => $e, 'encodeURIComponentIDN';