1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
package Unicode::Stringprep::_Common;
require 5.008_003;
use strict;
use utf8;
use warnings;
use Exporter;
our $VERSION = "1.10";
$VERSION = eval { $VERSION };
our @ISA = ('Exporter');
our @EXPORT = ('_mk_set', '_mk_map');
sub _mk_set {
my @data = ();
foreach my $line (split /\n/, shift) {
my($from,$comment) = split /;/, $line;
$from =~ s/[^0-9A-Z-]//gi;
($from,my $to) = split(/-/, $from, 2);
push @data, (hex($from), ($to ? hex($to) : undef));
}
return @data;
};
sub _mk_map {
my @data = ();
foreach my $line (split /\n/, shift) {
my($from,$to,$comment) = split /;/, $line;
$from =~ s/[^0-9A-F]//gi;
$to =~ s/[^0-9A-F ]//gi;
push @data,
hex($from),
join('',map {
$_ eq ''
? ''
: chr(hex($_))
}
split(' ', $to));
}
return @data;
};
1;
=head1 NAME
Unicode::Stringprep::_Common - Internal functions for C<Unicode::Stringprep::*>
=head1 AUTHOR
Claus FE<auml>rber E<lt>CFAERBER@cpan.orgE<gt>
=head1 LICENSE
Copyright 2007-2009 Claus FE<auml>rber. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
|