r4465 - in /packages/libidna-punycode-perl: ./ tags/ trunk/
trunk/debian/ trunk/lib/ trunk/lib/IDNA/ trunk/t/
kjetil-guest at users.alioth.debian.org
kjetil-guest at users.alioth.debian.org
Thu Nov 30 11:47:23 CET 2006
Author: kjetil-guest
Date: Thu Nov 30 11:47:22 2006
New Revision: 4465
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=4465
Log:
[svn-inject] Installing original source of libidna-punycode-perl
Added:
packages/libidna-punycode-perl/
packages/libidna-punycode-perl/tags/
packages/libidna-punycode-perl/trunk/
packages/libidna-punycode-perl/trunk/Changes
packages/libidna-punycode-perl/trunk/MANIFEST
packages/libidna-punycode-perl/trunk/Makefile.PL
packages/libidna-punycode-perl/trunk/README
packages/libidna-punycode-perl/trunk/debian/
packages/libidna-punycode-perl/trunk/debian/changelog
packages/libidna-punycode-perl/trunk/debian/compat
packages/libidna-punycode-perl/trunk/debian/control
packages/libidna-punycode-perl/trunk/debian/copyright
packages/libidna-punycode-perl/trunk/debian/rules (with props)
packages/libidna-punycode-perl/trunk/lib/
packages/libidna-punycode-perl/trunk/lib/IDNA/
packages/libidna-punycode-perl/trunk/lib/IDNA/.Punycode.pm.swp (with props)
packages/libidna-punycode-perl/trunk/lib/IDNA/Punycode.pm
packages/libidna-punycode-perl/trunk/t/
packages/libidna-punycode-perl/trunk/t/00_compile.t
Added: packages/libidna-punycode-perl/trunk/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libidna-punycode-perl/trunk/Changes?rev=4465&op=file
==============================================================================
--- packages/libidna-punycode-perl/trunk/Changes (added)
+++ packages/libidna-punycode-perl/trunk/Changes Thu Nov 30 11:47:22 2006
@@ -1,0 +1,11 @@
+Revision history for Perl extension IDNA::Punycode
+
+0.03 Thu Sep 1 14:49:17 MEST 2005
+ * added idn_prefix() function
+ * made "xn--" default prefix for punycode format
+
+0.02 Mon May 20 12:17:26 JST 2002
+ * [API change] now exception is thrown in conversion failure
+
+0.01 Tue May 7 11:47:28 2002
+ - original version
Added: packages/libidna-punycode-perl/trunk/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libidna-punycode-perl/trunk/MANIFEST?rev=4465&op=file
==============================================================================
--- packages/libidna-punycode-perl/trunk/MANIFEST (added)
+++ packages/libidna-punycode-perl/trunk/MANIFEST Thu Nov 30 11:47:22 2006
@@ -1,0 +1,5 @@
+Changes
+MANIFEST This list of files
+Makefile.PL
+lib/IDNA/Punycode.pm
+t/00_compile.t
Added: packages/libidna-punycode-perl/trunk/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libidna-punycode-perl/trunk/Makefile.PL?rev=4465&op=file
==============================================================================
--- packages/libidna-punycode-perl/trunk/Makefile.PL (added)
+++ packages/libidna-punycode-perl/trunk/Makefile.PL Thu Nov 30 11:47:22 2006
@@ -1,0 +1,9 @@
+use ExtUtils::MakeMaker;
+require 5.6.0;
+WriteMakefile(
+ 'NAME' => 'IDNA::Punycode',
+ 'VERSION_FROM' => 'lib/IDNA/Punycode.pm', # finds $VERSION
+ 'PREREQ_PM' => {
+ 'Test::More' => 0.32,
+ },
+);
Added: packages/libidna-punycode-perl/trunk/README
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libidna-punycode-perl/trunk/README?rev=4465&op=file
==============================================================================
--- packages/libidna-punycode-perl/trunk/README (added)
+++ packages/libidna-punycode-perl/trunk/README Thu Nov 30 11:47:22 2006
@@ -1,0 +1,23 @@
+IDNA::Punycode - conversion from IDN domain names to Punycode and back
+======================================================================
+
+1. DESCRIPTION
+--------------
+
+IDNA::Punycode will convert a domain-name from the "native" IDN
+(Internationalized Domain Name) form, i.e., a domain-name
+containing non-ASCII characters, into it's corresponding
+ACE (ASCII Compatible Encoding), and vice versa.
+
+Before you do the ACE conversion, however, you must first "normalize"
+the string to convert using Net::IDN::Nameprep. See RFC3940
+(http://www.ietf.org/rfc/rfc3490.txt) for more information.
+
+IDNA::Punycode has no dependencies.
+
+2. COPYRIGHT
+------------
+
+Copyright (c) Tatsuhiko Miyagawa <miyagawa at bulknews.net>. This program
+is free software; you can redistribute it and/or modify it under the
+same terms as Perl itself
Added: packages/libidna-punycode-perl/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libidna-punycode-perl/trunk/debian/changelog?rev=4465&op=file
==============================================================================
--- packages/libidna-punycode-perl/trunk/debian/changelog (added)
+++ packages/libidna-punycode-perl/trunk/debian/changelog Thu Nov 30 11:47:22 2006
@@ -1,0 +1,6 @@
+libidna-punycode-perl (0.03-1) unstable; urgency=low
+
+ * Initial Release.
+
+ -- Kjetil Kjernsmo (Work key) <kjetilk at opera.com> Thu, 30 Nov 2006 11:35:46 +0100
+
Added: packages/libidna-punycode-perl/trunk/debian/compat
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libidna-punycode-perl/trunk/debian/compat?rev=4465&op=file
==============================================================================
--- packages/libidna-punycode-perl/trunk/debian/compat (added)
+++ packages/libidna-punycode-perl/trunk/debian/compat Thu Nov 30 11:47:22 2006
@@ -1,0 +1,1 @@
+5
Added: packages/libidna-punycode-perl/trunk/debian/control
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libidna-punycode-perl/trunk/debian/control?rev=4465&op=file
==============================================================================
--- packages/libidna-punycode-perl/trunk/debian/control (added)
+++ packages/libidna-punycode-perl/trunk/debian/control Thu Nov 30 11:47:22 2006
@@ -1,0 +1,15 @@
+Source: libidna-punycode-perl
+Section: perl
+Priority: optional
+Build-Depends: debhelper (>= 5.0.0)
+Build-Depends-Indep: perl (>= 5.6.0), perl-modules
+Maintainer: Kjetil Kjernsmo (Work key) <kjetilk at opera.com>
+Standards-Version: 3.7.2
+
+Package: libidna-punycode-perl
+Architecture: all
+Depends: ${perl:Depends}, ${misc:Depends},
+Description: encodes Unicode string in Punycode
+ IDNA::Punycode is a module to encode / decode Unicode strings into
+ Punycode, an efficient encoding of Unicode for use with IDNA.
+
Added: packages/libidna-punycode-perl/trunk/debian/copyright
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libidna-punycode-perl/trunk/debian/copyright?rev=4465&op=file
==============================================================================
--- packages/libidna-punycode-perl/trunk/debian/copyright (added)
+++ packages/libidna-punycode-perl/trunk/debian/copyright Thu Nov 30 11:47:22 2006
@@ -1,0 +1,12 @@
+This is the debian package for the IDNA::Punycode module.
+It was created by Kjetil Kjernsmo <kjetilk at opera.com> using dh-make-perl.
+
+The upstream author's statement is:
+
+Tatsuhiko Miyagawa <miyagawa at bulknews.net> is the original
+author and wrote almost all the code.
+
+Robert Urban <urban at UNIX-Beratung.de> added idn_prefix().
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
Added: packages/libidna-punycode-perl/trunk/debian/rules
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libidna-punycode-perl/trunk/debian/rules?rev=4465&op=file
==============================================================================
--- packages/libidna-punycode-perl/trunk/debian/rules (added)
+++ packages/libidna-punycode-perl/trunk/debian/rules Thu Nov 30 11:47:22 2006
@@ -1,0 +1,83 @@
+#!/usr/bin/make -f
+# This debian/rules file is provided as a template for normal perl
+# packages. It was created by Marc Brockschmidt <marc at dch-faq.de> for
+# the Debian Perl Group (http://pkg-perl.alioth.debian.org/) but may
+# be used freely wherever it is useful.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# If set to a true value then MakeMaker's prompt function will
+# always return the default without waiting for user input.
+export PERL_MM_USE_DEFAULT=1
+
+PACKAGE=$(shell dh_listpackages)
+
+ifndef PERL
+PERL = /usr/bin/perl
+endif
+
+TMP =$(CURDIR)/debian/$(PACKAGE)
+
+build: build-stamp
+build-stamp:
+ dh_testdir
+
+ # Add commands to compile the package here
+ $(PERL) Makefile.PL INSTALLDIRS=vendor
+ $(MAKE) OPTIMIZE="-Wall -O2 -g"
+
+ touch build-stamp
+
+clean:
+ dh_testdir
+ dh_testroot
+
+ # Add commands to clean up after the build process here
+ [ ! -f Makefile ] || $(MAKE) realclean
+
+ dh_clean build-stamp install-stamp
+
+install: build install-stamp
+install-stamp:
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+
+ # Add commands to install the package into debian/$PACKAGE_NAME here
+ $(MAKE) test
+ $(MAKE) install DESTDIR=$(TMP) PREFIX=/usr
+
+ # As this is a architecture independent package, we are not
+ # supposed to install stuff to /usr/lib. MakeMaker creates
+ # the dirs, we delete them from the deb:
+ rmdir --ignore-fail-on-non-empty --parents $(TMP)/usr/lib/perl5
+
+ touch install-stamp
+
+binary-arch:
+# We have nothing to do by default.
+
+binary-indep: build install
+ dh_testdir
+ dh_testroot
+# dh_installcron
+# dh_installmenu
+# dh_installexamples
+ dh_installdocs README
+ dh_installchangelogs Changes
+ dh_perl
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+source diff:
+ @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary
Propchange: packages/libidna-punycode-perl/trunk/debian/rules
------------------------------------------------------------------------------
svn:executable =
Added: packages/libidna-punycode-perl/trunk/lib/IDNA/.Punycode.pm.swp
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libidna-punycode-perl/trunk/lib/IDNA/.Punycode.pm.swp?rev=4465&op=file
==============================================================================
Binary file - no diff available.
Propchange: packages/libidna-punycode-perl/trunk/lib/IDNA/.Punycode.pm.swp
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: packages/libidna-punycode-perl/trunk/lib/IDNA/Punycode.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libidna-punycode-perl/trunk/lib/IDNA/Punycode.pm?rev=4465&op=file
==============================================================================
--- packages/libidna-punycode-perl/trunk/lib/IDNA/Punycode.pm (added)
+++ packages/libidna-punycode-perl/trunk/lib/IDNA/Punycode.pm Thu Nov 30 11:47:22 2006
@@ -1,0 +1,240 @@
+package IDNA::Punycode;
+
+use strict;
+our $VERSION = 0.03;
+
+require Exporter;
+our @ISA = qw(Exporter);
+our @EXPORT = qw(encode_punycode decode_punycode idn_prefix);
+
+use integer;
+
+our $DEBUG = 0;
+our $PREFIX = 'xn--';
+
+use constant BASE => 36;
+use constant TMIN => 1;
+use constant TMAX => 26;
+use constant SKEW => 38;
+use constant DAMP => 700;
+use constant INITIAL_BIAS => 72;
+use constant INITIAL_N => 128;
+
+my $Delimiter = chr 0x2D;
+my $BasicRE = qr/[\x00-\x7f]/;
+
+sub _croak { require Carp; Carp::croak(@_); }
+
+sub idn_prefix {
+ $PREFIX = shift;
+}
+
+sub digit_value {
+ my $code = shift;
+ return ord($code) - ord("A") if $code =~ /[A-Z]/;
+ return ord($code) - ord("a") if $code =~ /[a-z]/;
+ return ord($code) - ord("0") + 26 if $code =~ /[0-9]/;
+ return;
+}
+
+sub code_point {
+ my $digit = shift;
+ return $digit + ord('a') if 0 <= $digit && $digit <= 25;
+ return $digit + ord('0') - 26 if 26 <= $digit && $digit <= 36;
+ die 'NOT COME HERE';
+}
+
+sub adapt {
+ my($delta, $numpoints, $firsttime) = @_;
+ $delta = $firsttime ? $delta / DAMP : $delta / 2;
+ $delta += $delta / $numpoints;
+ my $k = 0;
+ while ($delta > ((BASE - TMIN) * TMAX) / 2) {
+ $delta /= BASE - TMIN;
+ $k += BASE;
+ }
+ return $k + (((BASE - TMIN + 1) * $delta) / ($delta + SKEW));
+}
+
+sub decode_punycode {
+ my $code = shift;
+
+ my $n = INITIAL_N;
+ my $i = 0;
+ my $bias = INITIAL_BIAS;
+ my @output;
+
+ if ($PREFIX) {
+ if ($code !~ /^$PREFIX/) {
+ return $code;
+ }
+ $code =~ s/^$PREFIX//;
+ }
+
+ if ($code =~ s/(.*)$Delimiter//o) {
+ push @output, map ord, split //, $1;
+ return _croak('non-basic code point') unless $1 =~ /^$BasicRE*$/o;
+ }
+
+ while ($code) {
+ my $oldi = $i;
+ my $w = 1;
+ LOOP:
+ for (my $k = BASE; 1; $k += BASE) {
+ my $cp = substr($code, 0, 1, '');
+ my $digit = digit_value($cp);
+ defined $digit or return _croak("invalid punycode input");
+ $i += $digit * $w;
+ my $t = ($k <= $bias) ? TMIN
+ : ($k >= $bias + TMAX) ? TMAX : $k - $bias;
+ last LOOP if $digit < $t;
+ $w *= (BASE - $t);
+ }
+ $bias = adapt($i - $oldi, @output + 1, $oldi == 0);
+ warn "bias becomes $bias" if $DEBUG;
+ $n += $i / (@output + 1);
+ $i = $i % (@output + 1);
+ splice(@output, $i, 0, $n);
+ warn join " ", map sprintf('%04x', $_), @output if $DEBUG;
+ $i++;
+ }
+ return join '', map chr, @output;
+}
+
+sub encode_punycode {
+ my $input = shift;
+ # my @input = split //, $input; # doesn't work in 5.6.x!
+ my @input = map substr($input, $_, 1), 0..length($input)-1;
+
+ my $n = INITIAL_N;
+ my $delta = 0;
+ my $bias = INITIAL_BIAS;
+
+ my @output;
+ my @basic = grep /$BasicRE/, @input;
+ my $h = my $b = @basic;
+ #push @output, @basic, $Delimiter if $b > 0;
+ push @output, @basic if $b > 0;
+ warn "basic codepoints: (@output)" if $DEBUG;
+
+ if ($h < @input) {
+ $PREFIX && unshift(@output, $PREFIX);
+ push(@output, $Delimiter);
+ } else {
+ return join '', @output;
+ }
+
+ while ($h < @input) {
+ my $m = min(grep { $_ >= $n } map ord, @input);
+ warn sprintf "next code point to insert is %04x", $m if $DEBUG;
+ $delta += ($m - $n) * ($h + 1);
+ $n = $m;
+ for my $i (@input) {
+ my $c = ord($i);
+ $delta++ if $c < $n;
+ if ($c == $n) {
+ my $q = $delta;
+ LOOP:
+ for (my $k = BASE; 1; $k += BASE) {
+ my $t = ($k <= $bias) ? TMIN :
+ ($k >= $bias + TMAX) ? TMAX : $k - $bias;
+ last LOOP if $q < $t;
+ my $cp = code_point($t + (($q - $t) % (BASE - $t)));
+ push @output, chr($cp);
+ $q = ($q - $t) / (BASE - $t);
+ }
+ push @output, chr(code_point($q));
+ $bias = adapt($delta, $h + 1, $h == $b);
+ warn "bias becomes $bias" if $DEBUG;
+ $delta = 0;
+ $h++;
+ }
+ }
+ $delta++;
+ $n++;
+ }
+ return join '', @output;
+}
+
+sub min {
+ my $min = shift;
+ for (@_) { $min = $_ if $_ <= $min }
+ return $min;
+}
+
+1;
+__END__
+
+=head1 NAME
+
+IDNA::Punycode - encodes Unicode string in Punycode
+
+=head1 SYNOPSIS
+
+ use IDNA::Punycode;
+ idn_prefix('xn--');
+ $punycode = encode_punycode($unicode);
+ $unicode = decode_punycode($punycode);
+
+=head1 DESCRIPTION
+
+IDNA::Punycode is a module to encode / decode Unicode strings into
+Punycode, an efficient encoding of Unicode for use with IDNA.
+
+This module requires Perl 5.6.0 or over to handle UTF8 flagged Unicode
+strings.
+
+=head1 FUNCTIONS
+
+This module exports following functions by default.
+
+=over 4
+
+=item encode_punycode
+
+ $punycode = encode_punycode($unicode);
+
+takes Unicode string (UTF8-flagged variable) and returns Punycode
+encoding for it.
+
+=item decode_punycode
+
+ $unicode = decode_punycode($punycode)
+
+takes Punycode encoding and returns original Unicode string.
+
+=item idn_prefix
+
+ idn_prefix($prefix);
+
+causes encode_punycode() to add $prefix to ACE-string after conversion.
+As a side-effect decode_punycode() will only consider strings
+beginning with $prefix as punycode representations.
+
+According to RFC 3490 the ACE prefix "xn--" had been chosen as the
+standard. Thus, "xn--" is also the default ACE prefix. For compatibility
+I'm leaving idn_prefix() in the module. Use C<idn_prefix(undef)> to
+get the old behaviour.
+
+=back
+
+These functions throws exceptionsn on failure. You can catch 'em via
+C<eval>.
+
+=head1 AUTHORS
+
+Tatsuhiko Miyagawa E<lt>miyagawa at bulknews.netE<gt> is the original
+author and wrote almost all the code.
+
+Robert Urban E<lt>urban at UNIX-Beratung.deE<gt> added C<idn_prefix()>.
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=head1 SEE ALSO
+
+http://www.ietf.org/internet-drafts/draft-ietf-idn-punycode-01.txt
+
+L<Encode::Punycode>
+
+=cut
Added: packages/libidna-punycode-perl/trunk/t/00_compile.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/libidna-punycode-perl/trunk/t/00_compile.t?rev=4465&op=file
==============================================================================
--- packages/libidna-punycode-perl/trunk/t/00_compile.t (added)
+++ packages/libidna-punycode-perl/trunk/t/00_compile.t Thu Nov 30 11:47:22 2006
@@ -1,0 +1,4 @@
+use strict;
+use Test::More tests => 1;
+
+BEGIN { use_ok 'IDNA::Punycode' }
More information about the Pkg-perl-cvs-commits
mailing list