libnet-libidn-perl-0.12.ds.orig/0000750000175000017500000000000011240556162015743 5ustar gregoagregoalibnet-libidn-perl-0.12.ds.orig/_LibIDN.pm0000644000175000017500000001647211151507273017520 0ustar gregoagregoapackage Net::LibIDN; use 5.006; use strict; use warnings; use Errno; use Carp; require Exporter; require DynaLoader; use AutoLoader; our @ISA = qw(Exporter DynaLoader); # Items to export into callers namespace by default. Note: do not export # names by default without a very good reason. Use EXPORT_OK instead. # Do not simply export all your public functions/methods/constants. # This allows declaration use Net::LibIDN ':all'; # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK # will save memory. our %EXPORT_TAGS = ( 'all' => [ qw( idn_to_ascii idn_to_unicode idn_punycode_encode idn_punycode_decode idn_prep_name idn_prep_kerberos5 idn_prep_node idn_prep_resource idn_prep_plain idn_prep_trace idn_prep_sasl idn_prep_iscsi #IF_TLD tld_check tld_get tld_get_table #ENDIF_TLD IDNA_ALLOW_UNASSIGNED IDNA_USE_STD3_ASCII_RULES ) ] ); our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); our @EXPORT = qw( IDNA_ALLOW_UNASSIGNED IDNA_USE_STD3_ASCII_RULES ); our $VERSION = '0.12'; # avoid prototyping error message sub IDNA_ALLOW_UNASSIGNED { return constant("IDNA_ALLOW_UNASSIGNED", length("IDNA_ALLOW_UNASSIGNED")); } sub IDNA_USE_STD3_ASCII_RULES { return constant("IDNA_USE_STD3_ASCII_RULES", length("IDNA_USE_STD3_ASCII_RULES")); } sub AUTOLOAD { # This AUTOLOAD is used to 'autoload' constants from the constant() # XS function. If a constant is not found then control is passed # to the AUTOLOAD in AutoLoader. my $constname; our $AUTOLOAD; ($constname = $AUTOLOAD) =~ s/.*:://; croak "& not defined" if $constname eq 'constant'; my $val = constant($constname, @_ ? $_[0] : 0); if ($! != 0) { if ($!{EINVAL}) { $AutoLoader::AUTOLOAD = $AUTOLOAD; goto &AutoLoader::AUTOLOAD; } else { croak "Your vendor has not defined Net::LibIDN macro $constname"; } } { no strict 'refs'; # Fixed between 5.005_53 and 5.005_61 if ($] >= 5.00561) { *$AUTOLOAD = sub () { $val }; } else { *$AUTOLOAD = sub { $val }; } } goto &$AUTOLOAD; } bootstrap Net::LibIDN $VERSION; # Preloaded methods go here. # Autoload methods go after =cut, and are processed by the autosplit program. 1; __END__ =encoding latin1 =head1 NAME Net::LibIDN - Perl bindings for GNU Libidn =head1 SYNOPSIS use Net::LibIDN ':all'; idn_to_ascii("Räksmörgås.Josefßon.ORG") eq idn_to_ascii(idn_to_unicode("xn--rksmrgs-5wao1o.josefsson.org")); idn_prep_name("LibÜDN") eq "libüdn"; idn_punycode_encode("kistenmöhre") eq idn_punycode_encode(idn_punycode_decode("kistenmhre-kcb")); #IF_TLD my $errpos; tld_check("mèrle.se", $errpos) eq undef; $errpos == 1; tld_get("mainbase.mars") eq "mars"; my $hashref = Net::LibIDN::tld_get_table("de"); print "$hashref->{version}\n"; foreach (@{$hashref->{valid}}) { print "Unicode range from ".$_->{start}." to ".$_->{end}."\n"; } #ENDIF_TLD =head1 DESCRIPTION Provides bindings for GNU Libidn, a C library for handling Internationalized Domain Names according to IDNA (RFC 3490), in a way very much inspired by Turbo Fredriksson's PHP-IDN. =head2 Functions =over 4 =item B(I<$clear_hostname>, [I<$charset>, [I<$flags>]]); Converts I<$clear_hostname> which might contain characters outside the range allowed in DNS names, to IDNA ACE. If I<$charset> is specified, treats string as being encoded in it, otherwise assumes it is ISO-8859-1 encoded. If flag B is set in I<$flags>, accepts also unassigned Unicode characters, if B is set, accepts only ASCII LDH characters (letter-digit-hyphen). Flags can be combined with ||. Returns result of conversion or B on error. =item B(I<$idn_hostname>, [I<$charset>, [I<$flags>]]); Converts ASCII I<$idn_hostname>, which might be IDNA ACE encoded, into the decoded form in I<$charset> or ISO-8859-1. Flags are interpreted as above. Returns result of conversion or B on error. =item B(I<$string>, [I<$charset>]); Encodes I<$string> into "punycode" (RFC 3492). If I<$charset> is present, treats I<$string> as being in I<$charset>, otherwise uses ISO-8859-1. Returns result of conversion or B on error. =item B(I<$string>, [I<$charset>]); Decodes I<$string> from "punycode" (RFC 3492). If I<$charset> is present, result is converted to I<$charset>, otherwise it is converted to ISO-8859-1. Returns result of conversion or B on error. =item B(I<$string>, [I<$charset>]); =item B(I<$string>, [I<$charset>]); =item B(I<$string>, [I<$charset>]); =item B(I<$string>, [I<$charset>]); =item B(I<$string>, [I<$charset>]); =item B(I<$string>, [I<$charset>]); =item B(I<$string>, [I<$charset>]); =item B(I<$string>, [I<$charset>]); Performs "stringprep" (RFC 3454) on $string according to the named profile (e.g. *_name -> "nameprep" (RFC 3491)). If I<$charset> is present, converts from and to this charset before and after the operation respectively. Returns result string, or B on error. #IF_TLD =item B(I<$string>, I<$errpos>, [I<$charset>, [I<$tld>]]); Checks whether or not I<$string> conforms to the restrictions on the sets of valid characters defined by TLD authorities around the World. Treats I<$string> as a hostname if I<$tld> is not present, determining the TLD from the hostname. If I<$tld> is present, uses the restrictions defined by the parties responsible for TLD I<$tld>. I<$charset> may be used to specify the character set the I<$string> is in. Should an invalid character be detected, returns 0 and the 0-based position of the offending character in I<$errpos>. In case of other failure conditions, I<$errpos> is not touched, and B is returned. Should I<$string> conform to the TLD restrictions, 1 is returned. =item B(I<$hostname>); Returns top level domain of I<$hostname>, or B if an error occurs or if no top level domain was found. =item B(I<$tld>); Retrieves a hash reference with the TLD restriction info of given TLD I<$tld>, or B if I<$tld> is not found. The hash ref contains the following fields: =over 4 =item * I<$h->>I<{name}> ... name of TLD =item * I<$h->>I<{version}> ... version string of this restriction table =item * I<$h->>I<{nvalid}> ... number of Unicode intervals =item * I<$h->>I<{valid}> ... [ {I => number, I => number}, ...] ... Unicode intervals =back #ENDIF_TLD =back =head2 Limitations There is currently no support for Perl's unicode capabilities (man perlunicode). All input strings are assumed to be octet strings, all output strings are generated as octet strings. Thus, if you require Perl's unicode features, you will have to convert your strings manually. For example: =over 4 use Encode; use Data::Dumper; print Dumper(Net::LibIDN::idn_to_unicode('xn--uro-j50a.com', 'utf-8')); print Dumper(decode('utf-8', Net::LibIDN::idn_to_unicode('xn--uro-j50a.com', 'utf-8'))); =back =head1 AUTHOR Thomas Jacob, http://internet24.de =head1 SEE ALSO perl(1), RFC 3454, RFC 3490-3492, http://www.gnu.org/software/libidn. =cut libnet-libidn-perl-0.12.ds.orig/Makefile.PL0000644000175000017500000000724311151503211017714 0ustar gregoagregoause strict; use ExtUtils::MakeMaker; use Getopt::Long; use Config; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. my $options; my $testno=1; my %MakeParams = InitMakeParams(); WriteMakefile(%MakeParams); sub MY::postamble { " LibIDN.pm: _LibIDN.pm _test.pl perl Makefile.PL $options test.pl: _test.pl perl Makefile.PL $options " } sub InitMakeParams { my %Params = ( 'NAME' => 'Net::LibIDN', 'VERSION_FROM' => 'LibIDN.pm', # finds $VERSION 'PREREQ_PM' => {}, # e.g., Module::Name => 1.1 ($] >= 5.005 ? ## Add these new keywords supported since 5.005 (ABSTRACT_FROM => 'LibIDN.pm', # retrieve abstract from module AUTHOR => 'Thomas Jacob ') : ()), PM => { 'LibIDN.pm' => '$(INST_LIB)/Net/LibIDN.pm' }, clean => { FILES => "test.pl LibIDN.pm" } ); my ($libdir, $incdir, $disable_tld); $options=join(' ', @ARGV); GetOptions ( "with-libidn=s" => \$libdir, "with-libidn-inc=s" => \$incdir, "disable-tld" => \$disable_tld ); if ($libdir) { $Params{LIBS} = "-L$libdir -lidn"; } else { $Params{LIBS} = $Config{ldflags} . ' -lidn'; } if ($incdir) { $Params{INC} = "-I$incdir"; } else { $Params{INC} = ''; } my $libidn = CheckLibidn($Params{INC}, $Params{LIBS}); unless($libidn) { print "This module requires GNU Libidn, which could not be found.\n" unless $libidn; exit 0; } print "Found LibIDN, "; print $libidn == 1? "without": "with"; print " TLD checking support\n"; if ($libidn == 2 && $disable_tld) { print "TLD checking support disabled at user request\n"; } $disable_tld = 1 if ($libidn<2); if ($disable_tld) { $Params{DEFINE} = ''; } else { $Params{DEFINE} = '-DHAVE_TLD'; } FilterTLD("_LibIDN.pm", "LibIDN.pm", !$disable_tld); FilterTLD("_test.pl", "test.pl", !$disable_tld); return(%Params); } sub FilterTLD { my $in = shift; my $out = shift; my $tld = shift; local *IN, *OUT; open(IN, "<$in") || die "Can't open file $in\n"; open(OUT, ">$out") || die "Can't write file $out\n"; my ($inside, $else); while() { if (m/^#IF_TLD/) { $inside = 1; next; } if (m/^#ELSE_TLD/) { $else = 1; next; } if (m/^#ENDIF_TLD/) { $inside = 0; $else = 0; next; } if ($inside) { if ($tld) { print OUT $_ unless $else; } elsif($else) { print OUT $_; } } else { print OUT $_; } } } sub CheckCCode { my $code = shift; my $cflags = shift; my $ldflags = shift; my $output = shift; my $test = '__test'.$testno++; local * FILE; if (open(FILE, ">$test.c")) { print FILE $code; close(FILE); } else { return 0; } foreach my $cc (qw/cc gcc/) { unlink($test); system "$cc $cflags -o $test $test.c $ldflags"; next if ($? >> 8); if (open(FILE, "./$test|")) { my $match; while() { $match = 1 if $_ eq $output; last; } close(FILE); next unless $match; } else { next; } unlink($test); unlink("$test.c"); return 1; } return 0; } sub CheckLibidn { my $cflags = shift; my $ldflags = shift; my $result; my $final; local * FILE; my $test1 = < #include int main(void) { char * output; int res; res = idna_to_ascii_8z("libidn", &output, 0); printf("%d-%s", res, output); return 0; } EOT return $result unless CheckCCode($test1, $cflags, $ldflags, "0-libidn"); $result = 1; my $test2 = < #include int main(void) { char * output; int res; res =tld_get_z ("libidn.idn", &output); printf("%d-%s", res, output); return 0; } EOT return $result unless CheckCCode($test2, $cflags, $ldflags, "0-idn"); return 2; } libnet-libidn-perl-0.12.ds.orig/_test.pl0000644000175000017500000000400710043153260017414 0ustar gregoagregoa# Before `make install' is performed this script should be runnable with # `make test'. After `make install' it should work as `perl test.pl' ######################### use strict; use Test; #IF_TLD BEGIN { plan tests => 21, todo => [] }; #ELSE_TLD BEGIN { plan tests => 10, todo => [] }; #ENDIF_TLD use Net::LibIDN; ######################### ok(Net::LibIDN::idn_to_ascii("b\xF6se.de", "ISO-8859-1"), "xn--bse-sna.de"); ok(Net::LibIDN::idn_to_ascii("b\xC3\xB6se.de","UTF-8"), "xn--bse-sna.de"); ok(Net::LibIDN::idn_to_unicode("xn--bse-sna.de", "ISO-8859-1"), "b\xF6se.de"); ok(Net::LibIDN::idn_to_unicode("xn--bse-sna.de", "UTF-8"), "b\xC3\xB6se.de"); ok(Net::LibIDN::idn_punycode_encode("\xDCHHH\xC4AHHH", "ISO-8859-1"), "HHHAHHH-wpa6s"); ok(Net::LibIDN::idn_punycode_encode("\xC3\x9CHHH\xC3\x84AHHH", "UTF-8"), "HHHAHHH-wpa6s"); ok(Net::LibIDN::idn_punycode_decode("HHHAHHH-wpa6s", "ISO-8859-1"), "\xDCHHH\xC4AHHH"); ok(Net::LibIDN::idn_punycode_decode("HHHAHHH-wpa6s", "UTF-8"), "\xC3\x9CHHH\xC3\x84AHHH"); ok(Net::LibIDN::idn_prep_name("GR\xD6\xDFeR", "ISO-8859-1"), "gr\xF6sser"); ok(Net::LibIDN::idn_prep_name("GR\xC3\xB6\xC3\x9Fer", "UTF-8"), "gr\xC3\xB6sser"); #IF_TLD my $has_nono; { my $res = Net::LibIDN::tld_get_table("no"); $has_nono = $$res{name} ne "no"; skip($has_nono, $$res{name}, "no"); skip($has_nono, $$res{nvalid}, 13); my $sum = 0; my $zero = 0; for (my $i=0; $i<13; $i++) { $zero = 1 if (!$$res{valid}[$i]{start} && !$$res{valid}[$i]{end}); $sum += $$res{valid}[$i]{start}; $sum += $$res{valid}[$i]{end}; } skip($has_nono, $sum, 7470); skip($has_nono, $zero, 0); } { my $errpos; my $res = Net::LibIDN::tld_check("p\xFBrle.no", $errpos, "ISO-8859-1"); skip($has_nono, $errpos, 1); skip($has_nono, $res, 0); } { my $errpos; my $res = Net::LibIDN::tld_check("p\xFBrle.no", $errpos, "ISO-8859-1", "com"); ok($errpos, 0); ok($res, 1); } ok(Net::LibIDN::tld_get("Kruder.DorfMeister"), "dorfmeister"); ok(Net::LibIDN::tld_get("GR\xC3\xB6\xC3\x9Fer"), undef); ok(Net::LibIDN::tld_get_table("mars"), undef); #ENDIF_TLD libnet-libidn-perl-0.12.ds.orig/Changes0000644000175000017500000000435611151507243017250 0ustar gregoagregoaRevision history for Perl extension Net::LibIDN. 0.12 Thu Feb 26 13:44:06 CET 2009 - Applied NetBSD compatibility patch (Thanks Havard Eidnes), fixes #39294 - Applied Win32 memory free compatibility patch (Thanks CPAN user SISYPHUS), maybe fixes #43110 0.11 Tue Aug 26 19:42:18 CEST 2008 - Move ldflags to back of cc test compile to improve the portability of Libidn installation checks yet again, thanks to nix of esperi dot o r g dot uk 0.10 Thu Dec 13 00:18:56 CET 2007 - Shut up CPAN tester mails - Correct some linitian problems 0.09 Mon Aug 7 19:20:00 CEST 2006 - Minor doc changes 0.08 Mon Jan 17 13:07:04 CET 2005 - Try cc as well as gcc when testing for a functioning Libidn-Installation in Makefile.PL to improve portability, thanks to Keith A Hackworth 0.07 Mon Apr 14 11:44:05 CEST 2004 - More debianization fixes from Matthias Urlichs - Makefile.PL remembers calling options in generated Makefile - Rewrote tests to not depend on "de"-Tables 0.06 Mon Mar 29 19:31:06 CEST 2004 - Added Cygwin compile infos (Thanks to Sergei Kolodka) - Fixed builddeps, dependency bug in Makefile.PL (Thanks to Matthias Urlichs) - A number of cosmetic changes 0.05 Thu Mar 18 16:15:33 CET 2004 - Test code now uses \xHH literals instead of direct non-ASCII character input, to be more portable, thanks to Sergei Kolodka for pointing out the problem - Added Perl prototypes - Using xs default parameters instead of C ellipsis in most functions - Remove typemap, we don't use types that require it - Tweak META.yml a little 0.04 Sun Feb 29 16:34:44 CET 2004 - Adapting to Dataformat changes in actual Libidn 0.4.0 release 0.03 Mon Feb 16 21:25:21 CET 2004 - Changed name to Net::LibIDN - Added support for TLD checking stuff in LibIDN >= 0.4.0 - Generally cleaned up the code - Wrote some meaningful docs - Makefile.PL checks if it can find Libidn with or without TLD checking - Added debian control files, thanks to dh-make-perl 0.02 Tue Jan 29 17:21:50 2004 - Minor Doc changes 0.01 Tue Dec 2 11:04:50 2003 - original version; created by h2xs 1.21 with options -xan NET::LibIDN idna.h - worked on it till it resembled the interface of php-idn of Turbo Fredriksson's php-idn bindings (http://php-idn.bayour.com/) libnet-libidn-perl-0.12.ds.orig/LibIDN.xs0000644000175000017500000002157711151504062017372 0ustar gregoagregoa#include "EXTERN.h" #include "perl.h" #include "XSUB.h" #include #include #include #include #ifdef HAVE_TLD #include #endif #define MAX_DNSLEN 4096 static char * default_charset= "ISO-8859-1"; char * idn_prep(char * string, char * charset, char * profile) { char * output = NULL; char * res_str = NULL; char * utf8 = NULL; int res; utf8 = stringprep_convert(string, "UTF-8", charset); if (!utf8) return NULL; res = stringprep_profile(utf8, &output, profile, 0); idn_free(utf8); if( (res != STRINGPREP_OK) || !output) return NULL; res_str = stringprep_convert(output, charset, "UTF-8"); idn_free(output); return res_str; } static double constant(char *name, int len, int arg) { errno = 0; if (0 + 5 >= len ) { errno = EINVAL; return 0; } switch (name[0 + 5]) { case 'A': if (strEQ(name + 0, "IDNA_ALLOW_UNASSIGNED")) { return IDNA_ALLOW_UNASSIGNED; } case 'U': if (strEQ(name + 0, "IDNA_USE_STD3_ASCII_RULES")) { return IDNA_USE_STD3_ASCII_RULES; } } errno = EINVAL; return 0; } MODULE = Net::LibIDN PACKAGE = Net::LibIDN double constant(sv,arg) PREINIT: STRLEN len; INPUT: SV * sv char * s = SvPV(sv, len); int arg CODE: RETVAL = constant(s,len,arg); OUTPUT: RETVAL char * idn_to_ascii(string, charset=default_charset, flags=0) char * string char * charset int flags PROTOTYPE: $;$$ PREINIT: char * utf8_str = NULL; char * tmp_str = NULL; int res; CODE: utf8_str = stringprep_convert(string, "UTF-8", charset); if (utf8_str) { res = idna_to_ascii_8z(utf8_str, &tmp_str, flags); idn_free(utf8_str); } else { XSRETURN_UNDEF; } if (res!=IDNA_SUCCESS) { XSRETURN_UNDEF; } RETVAL = tmp_str; OUTPUT: RETVAL CLEANUP: if (tmp_str) idn_free(tmp_str); char * idn_to_unicode(string, charset=default_charset, flags=0) char * string char * charset int flags; PROTOTYPE: $;$$ PREINIT: char * tmp_str = NULL; char * res_str = NULL; int res; CODE: res = idna_to_unicode_8z8z(string, &tmp_str, flags); if(res != IDNA_SUCCESS) { XSRETURN_UNDEF; } if (tmp_str) { res_str = stringprep_convert(tmp_str, charset, "UTF-8"); idn_free(tmp_str); } else { XSRETURN_UNDEF; } if (!res_str) { XSRETURN_UNDEF; } RETVAL = res_str; OUTPUT: RETVAL CLEANUP: idn_free(res_str); char * idn_punycode_encode(string, charset=default_charset) char * string char * charset PROTOTYPE: $;$ PREINIT: char * utf8_str = NULL; uint32_t * q = NULL; size_t len,len2; char * tmp_str = NULL; char * res_str = NULL; int res; CODE: utf8_str = stringprep_convert(string, "UTF-8", charset); if (utf8_str) { q = stringprep_utf8_to_ucs4(utf8_str, -1, &len); idn_free(utf8_str); } else { XSRETURN_UNDEF; } if (!q) { XSRETURN_UNDEF; } tmp_str = malloc(MAX_DNSLEN*sizeof(char)); len2 = MAX_DNSLEN-1; res = punycode_encode(len, q, NULL, &len2, tmp_str); idn_free(q); if (res != PUNYCODE_SUCCESS) { XSRETURN_UNDEF; } tmp_str[len2] = '\0'; res_str = stringprep_convert(tmp_str, charset, "UTF-8"); free(tmp_str); if (!res_str) { XSRETURN_UNDEF; } RETVAL = res_str; OUTPUT: RETVAL CLEANUP: idn_free(res_str); char * idn_punycode_decode(string, charset=default_charset) char * string char * charset; PROTOTYPE: $;$ PREINIT: char * utf8_str = NULL; uint32_t * q = NULL; size_t len; char * res_str = NULL; int res; CODE: len = MAX_DNSLEN-1; q = (uint32_t *) malloc(MAX_DNSLEN * sizeof(q[0])); if (q) { res = punycode_decode(strlen(string), string, &len, q, NULL ); } else { XSRETURN_UNDEF; } if (res != PUNYCODE_SUCCESS) { XSRETURN_UNDEF; } q[len] = '\0'; utf8_str = stringprep_ucs4_to_utf8(q, -1, NULL, NULL); free(q); if (utf8_str) { res_str = stringprep_convert(utf8_str, charset, "UTF-8"); idn_free(utf8_str); } else { XSRETURN_UNDEF; } if (!res_str) { XSRETURN_UNDEF; } RETVAL = res_str; OUTPUT: RETVAL CLEANUP: idn_free(res_str); char * idn_prep_name(string, charset=default_charset) char * string char * charset; PROTOTYPE: $;$ PREINIT: char * res_str = NULL; CODE: res_str = idn_prep(string, charset, "Nameprep"); if (!res_str) { XSRETURN_UNDEF; } RETVAL = res_str; OUTPUT: RETVAL CLEANUP: idn_free(res_str); char * idn_prep_kerberos5(string, charset=default_charset) char * string char * charset PROTOTYPE: $;$ PREINIT: char * res_str = NULL; CODE: res_str = idn_prep(string, charset, "KRBprep"); if (!res_str) { XSRETURN_UNDEF; } RETVAL = res_str; OUTPUT: RETVAL CLEANUP: idn_free(res_str); char * idn_prep_node(string, charset=default_charset) char * string char * charset PROTOTYPE: $;$ PREINIT: char * res_str = NULL; CODE: res_str = idn_prep(string, charset, "Nodeprep"); if (!res_str) { XSRETURN_UNDEF; } RETVAL = res_str; OUTPUT: RETVAL CLEANUP: idn_free(res_str); char * idn_prep_resource(string, charset=default_charset) char * string char * charset PROTOTYPE: $;$ PREINIT: char * res_str = NULL; CODE: res_str = idn_prep(string, charset, "Resourceprep"); if (!res_str) { XSRETURN_UNDEF; } RETVAL = res_str; OUTPUT: RETVAL CLEANUP: idn_free(res_str); char * idn_prep_plain(string, charset=default_charset) char * string char * charset PROTOTYPE: $;$ PREINIT: char * res_str = NULL; CODE: res_str = idn_prep(string, charset, "plain"); if (!res_str) { XSRETURN_UNDEF; } RETVAL = res_str; OUTPUT: RETVAL CLEANUP: idn_free(res_str); char * idn_prep_trace(string, charset=default_charset) char * string char * charset PROTOTYPE: $;$ PREINIT: char * res_str = NULL; CODE: res_str = idn_prep(string, charset, "trace"); if (!res_str) { XSRETURN_UNDEF; } RETVAL = res_str; OUTPUT: RETVAL CLEANUP: idn_free(res_str); char * idn_prep_sasl(string, charset=default_charset) char * string char * charset PROTOTYPE: $;$ PREINIT: char * res_str = NULL; CODE: res_str = idn_prep(string, charset, "SASLprep"); if (!res_str) { XSRETURN_UNDEF; } RETVAL = res_str; OUTPUT: RETVAL CLEANUP: idn_free(res_str); char * idn_prep_iscsi(string, charset=default_charset) char * string char * charset PROTOTYPE: $;$ PREINIT: char * res_str = NULL; CODE: res_str = idn_prep(string, charset, "ISCSIprep"); if (!res_str) { XSRETURN_UNDEF; } RETVAL = res_str; OUTPUT: RETVAL CLEANUP: idn_free(res_str); #ifdef HAVE_TLD int tld_check(string, errpos, ...) char *string size_t errpos PROTOTYPE: $$;$$ PREINIT: STRLEN c_len; char * charset = default_charset; char * tld = NULL; const Tld_table * tld_table = NULL; uint32_t *q; size_t len; char * utf8_str = NULL; char * tmp_str = NULL; int res; CODE: if (items>2) { if (ST(2) != &PL_sv_undef) charset = (char*)SvPV(ST(2), c_len); } if (items>3) { tld = (char*)SvPV(ST(3), c_len); tld_table = tld_default_table(tld, NULL); } utf8_str = stringprep_convert(string, "UTF-8", charset); if (!utf8_str) { XSRETURN_UNDEF; } res = stringprep_profile(utf8_str, &tmp_str, "Nameprep", 0); idn_free(utf8_str); if (res != STRINGPREP_OK) { XSRETURN_UNDEF; } if (tld) { q = stringprep_utf8_to_ucs4(tmp_str, -1, &len); idn_free(tmp_str); if (!q) { XSRETURN_UNDEF; } res = tld_check_4t(q, len, &errpos, tld_table); idn_free(q); } else { res = tld_check_8z(tmp_str, &errpos, NULL); idn_free(tmp_str); } if (res == TLD_SUCCESS) { RETVAL = 1; } else if (res == TLD_INVALID) { RETVAL = 0; } else { XSRETURN_UNDEF; } OUTPUT: RETVAL errpos char * tld_get(string) char *string PROTOTYPE: $ PREINIT: char *res_str = NULL; int res; CODE: res = tld_get_z(string, &res_str); if (res == TLD_SUCCESS) { RETVAL = res_str; } else { XSRETURN_UNDEF; } OUTPUT: RETVAL CLEANUP: idn_free(res_str); SV * tld_get_table(tld) char * tld PROTOTYPE: $ PREINIT: const Tld_table * tld_table = NULL; HV * rh, * reh; AV * ra; const Tld_table_element *e; size_t pos; CODE: tld_table = tld_default_table(tld, NULL); if (tld_table) { rh = (HV *)sv_2mortal((SV *)newHV()); hv_store(rh, "name", 4, newSVpv(tld_table->name, 0), 0); hv_store(rh, "version", 7, newSVpv(tld_table->version, 0), 0); hv_store(rh, "nvalid", 6, newSVuv(tld_table->nvalid), 0); ra = (AV *)sv_2mortal((SV *)newAV()); for (pos=0, e = tld_table->valid; posnvalid; pos++,e++) { reh = (HV *)sv_2mortal((SV *)newHV()); hv_store(reh, "start", 5, newSVuv(e->start), 0); hv_store(reh, "end", 3, newSVuv(e->end), 0); av_push(ra, newRV((SV *)reh)); } hv_store(rh, "valid", 5, newRV((SV*)ra), 0); RETVAL = newRV((SV*)rh); } else { XSRETURN_UNDEF; } OUTPUT: RETVAL #endif /* #ifdef HAVE_TLD */ libnet-libidn-perl-0.12.ds.orig/Artistic0000644000175000017500000001373707770556112017500 0ustar gregoagregoa The "Artistic License" Preamble The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. Definitions: "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification. "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder as specified below. "Copyright Holder" is whoever is named in the copyright or copyrights for the package. "You" is you, if you're thinking about copying or distributing this Package. "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.) "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. 1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. 2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following: a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as uunet.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. b) use the modified Package only within your corporation or organization. c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version. d) make other distribution arrangements with the Copyright Holder. 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. b) accompany the distribution with the machine-readable source of the Package with your modifications. c) give non-standard executables non-standard names, and clearly document the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. d) make other distribution arrangements with the Copyright Holder. 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. You may embed this Package's interpreter within an executable of yours (by linking); this shall be construed as a mere form of aggregation, provided that the complete Standard Version of the interpreter is so embedded. 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whoever generated them, and may be sold commercially, and may be aggregated with this Package. If such scripts or library files are aggregated with this Package via the so-called "undump" or "unexec" methods of producing a binary executable image, then distribution of such an image shall neither be construed as a distribution of this Package nor shall it fall under the restrictions of Paragraphs 3 and 4, provided that you do not represent such an executable image as a Standard Version of this Package. 7. C subroutines (or comparably compiled subroutines in other languages) supplied by you and linked into this Package in order to emulate subroutines and variables of the language defined by this Package shall not be considered part of this Package, but are the equivalent of input as in Paragraph 6, provided these subroutines do not change the language in any way that would cause it to fail the regression tests for the language. 8. Aggregation of this Package with a commercial distribution is always permitted provided that the use of this Package is embedded; that is, when no overt attempt is made to make this Package's interfaces visible to the end user of the commercial distribution. Such use shall not be construed as a distribution of this Package. 9. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. 10. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. The End libnet-libidn-perl-0.12.ds.orig/META.yml0000640000175000017500000000045311151510004017201 0ustar gregoagregoa# http://module-build.sourceforge.net/META-spec.html #XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# name: Net-LibIDN version: 0.12 version_from: LibIDN.pm installdirs: site requires: distribution_type: module generated_by: ExtUtils::MakeMaker version 6.30_01 libnet-libidn-perl-0.12.ds.orig/README0000644000175000017500000000764611151506465016647 0ustar gregoagregoaNet/LibIDN version 0.12 ======================= This module provides Perl bindings for GNU Libidn by Simon Josefsson (http://www.gnu.org/software/libidn/) in way that was heavily inspired by PHP bindings for the same library done by Turbo Fredriksson (http://php-idn.bayour.com/). INSTALLATION To install this module type the following: perl Makefile.PL [--with-libidn= --with-libidn-inc= --disable-tld] make make test make install Installing under Cygwin: Sergei Koladka reports that the first make line above needs to be replaced by make LD_RUN_PATH="/usr/lib" LDLOADLIBS="/usr/lib/libidn.a \/usr/lib/libiconv.dll.a" assuming that Libidn was compiled with --prefix=/usr. You also will need to remove the >>die "This module requires GNU Libidn..."<<-line and manually set $libidn either to 2 or 1 depending on whether you have/want to use TLD checking support. DEPENDENCIES This module requires these other modules and libraries: GNU Libidn >=0.5.0 Linux hint: If Makefile.PL says that it cannot find GNU Libidn, even though you compiled/installed it, consider adding the location of the Libidn .so files to /etc/ld.so.conf. Also, take a look at the --with-libidn and --with-libidn-inc options. COPYRIGHT AND LICENCE Perl Module Net::LibIDN Copyright 2003-2009, Thomas Jacob, Internet24.de All rights reserved This program is free software; you can redistribute it and/or modify it under the terms of either: a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version, or b) the "Artistic License" which comes with this Kit. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either the GNU General Public License or the Artistic License for more details. You should have received a copy of the Artistic License with this Kit, in the file named "Artistic". If not, I'll be glad to provide one. You should also have received a copy of the GNU General Public License along with this program in the file named "Copying". If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA or visit their web page on the internet at http://www.gnu.org/copyleft/gpl.html. For those of you that choose to use the GNU General Public License, my interpretation of the GNU General Public License is that no Perl script falls under the terms of the GPL unless you explicitly put said script under the terms of the GPL yourself. Furthermore, any object code linked with perl does not automatically fall under the terms of the GPL, provided such object code only adds definitions of subroutines and variables, and does not otherwise impair the resulting interpreter from executing any standard Perl script. I consider linking in C subroutines in this manner to be the moral equivalent of defining subroutines in the Perl language itself. You may sell such an object file as proprietary provided that you provide or offer to provide the Perl source, as specified by the GNU General Public License. (This is merely an alternate way of specifying input to the program.) You may also sell a binary produced by the dumping of a running Perl script that belongs to you, provided that you provide or offer to provide the Perl source as specified by the GPL. (The fact that a Perl interpreter and your code are in the same binary file is, in this case, a form of mere aggregation.) This is my interpretation of the GPL. If you still have concerns or difficulties understanding my intent, feel free to contact me. Of course, the Artistic License spells all this out for your protection, so you may prefer to use that. libnet-libidn-perl-0.12.ds.orig/MANIFEST0000644000175000017500000000034610026333327017101 0ustar gregoagregoaChanges _LibIDN.pm LibIDN.xs Makefile.PL MANIFEST README _test.pl Artistic META.yml Module meta-data (added by MakeMaker) debian/changelog debian/compat debian/control debian/copyright debian/rules