r67070 - in /branches/upstream/libstring-dirify-perl: ./ current/ current/lib/ current/lib/String/ current/t/
periapt-guest at users.alioth.debian.org
periapt-guest at users.alioth.debian.org
Wed Jan 5 18:48:08 UTC 2011
Author: periapt-guest
Date: Wed Jan 5 18:47:33 2011
New Revision: 67070
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=67070
Log:
[svn-inject] Installing original source of libstring-dirify-perl (1.01)
Added:
branches/upstream/libstring-dirify-perl/
branches/upstream/libstring-dirify-perl/current/
branches/upstream/libstring-dirify-perl/current/Build.PL
branches/upstream/libstring-dirify-perl/current/CHANGES
branches/upstream/libstring-dirify-perl/current/Changelog.ini
branches/upstream/libstring-dirify-perl/current/MANIFEST
branches/upstream/libstring-dirify-perl/current/META.yml
branches/upstream/libstring-dirify-perl/current/Makefile.PL
branches/upstream/libstring-dirify-perl/current/README
branches/upstream/libstring-dirify-perl/current/lib/
branches/upstream/libstring-dirify-perl/current/lib/String/
branches/upstream/libstring-dirify-perl/current/lib/String/Dirify.pm
branches/upstream/libstring-dirify-perl/current/t/
branches/upstream/libstring-dirify-perl/current/t/general.t (with props)
branches/upstream/libstring-dirify-perl/current/t/import.t (with props)
branches/upstream/libstring-dirify-perl/current/t/pod.t (with props)
branches/upstream/libstring-dirify-perl/current/t/separator.t (with props)
Added: branches/upstream/libstring-dirify-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libstring-dirify-perl/current/Build.PL?rev=67070&op=file
==============================================================================
--- branches/upstream/libstring-dirify-perl/current/Build.PL (added)
+++ branches/upstream/libstring-dirify-perl/current/Build.PL Wed Jan 5 18:47:33 2011
@@ -1,0 +1,17 @@
+use Module::Build;
+
+Module::Build -> new
+(
+ module_name => 'String::Dirify',
+ license => 'artistic',
+ dist_abstract => 'Convert a string into a directory name',
+ dist_author => 'Ron Savage <ron at savage.net.au>',
+ build_requires =>
+ {
+ Test::More => 0,
+ Test::Pod => 0,
+ },
+ requires =>
+ {
+ },
+) -> create_build_script();
Added: branches/upstream/libstring-dirify-perl/current/CHANGES
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libstring-dirify-perl/current/CHANGES?rev=67070&op=file
==============================================================================
--- branches/upstream/libstring-dirify-perl/current/CHANGES (added)
+++ branches/upstream/libstring-dirify-perl/current/CHANGES Wed Jan 5 18:47:33 2011
@@ -1,0 +1,7 @@
+Revision history for Perl extension String::Dirify.
+
+1.01 Wed Feb 10 13:53:05 2010
+ - Add META.yml. Update MANIFEST.SKIP. Add MANIFEST and MYMETA.yml.
+
+1.00 Fri Jun 26 11:09:00 2009
+ - Original version
Added: branches/upstream/libstring-dirify-perl/current/Changelog.ini
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libstring-dirify-perl/current/Changelog.ini?rev=67070&op=file
==============================================================================
--- branches/upstream/libstring-dirify-perl/current/Changelog.ini (added)
+++ branches/upstream/libstring-dirify-perl/current/Changelog.ini Wed Jan 5 18:47:33 2011
@@ -1,0 +1,12 @@
+[Module]
+Name=String::Dirify
+Changelog.Creator=Module::Metadata::Changes V 1.08
+Changelog.Parser=Config::IniFiles V 2.57
+
+[V 1.01]
+Date=2010-02-10T13:53:05
+Comments=- Add META.yml. Update MANIFEST.SKIP. Add MANIFEST and MYMETA.yml.
+
+[V 1.00]
+Date=2009-06-26T11:09:00
+Comments=- Original version
Added: branches/upstream/libstring-dirify-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libstring-dirify-perl/current/MANIFEST?rev=67070&op=file
==============================================================================
--- branches/upstream/libstring-dirify-perl/current/MANIFEST (added)
+++ branches/upstream/libstring-dirify-perl/current/MANIFEST Wed Jan 5 18:47:33 2011
@@ -1,0 +1,12 @@
+Build.PL
+Changelog.ini
+CHANGES
+lib/String/Dirify.pm
+Makefile.PL
+MANIFEST This list of files
+META.yml
+README
+t/general.t
+t/import.t
+t/pod.t
+t/separator.t
Added: branches/upstream/libstring-dirify-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libstring-dirify-perl/current/META.yml?rev=67070&op=file
==============================================================================
--- branches/upstream/libstring-dirify-perl/current/META.yml (added)
+++ branches/upstream/libstring-dirify-perl/current/META.yml Wed Jan 5 18:47:33 2011
@@ -1,0 +1,22 @@
+---
+abstract: 'Convert a string into a directory name'
+author:
+ - 'Ron Savage <ron at savage.net.au>'
+build_requires:
+ Test::More: 0
+ Test::Pod: 0
+configure_requires:
+ Module::Build: 0.36
+generated_by: 'Module::Build version 0.3607'
+license: artistic
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
+name: String-Dirify
+provides:
+ String::Dirify:
+ file: lib/String/Dirify.pm
+ version: 1.01
+resources:
+ license: http://www.perlfoundation.org/artistic_license_1_0
+version: 1.01
Added: branches/upstream/libstring-dirify-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libstring-dirify-perl/current/Makefile.PL?rev=67070&op=file
==============================================================================
--- branches/upstream/libstring-dirify-perl/current/Makefile.PL (added)
+++ branches/upstream/libstring-dirify-perl/current/Makefile.PL Wed Jan 5 18:47:33 2011
@@ -1,0 +1,31 @@
+use ExtUtils::MakeMaker;
+
+# See lib/ExtUtils/MakeMaker.pm for details of how to influence
+# the contents of the Makefile that is written.
+
+WriteMakefile
+(
+ ($] ge '5.005') ?
+ (
+ AUTHOR => 'Ron Savage (ron at savage.net.au)',
+ ABSTRACT => 'Convert a string into a directory name',
+ ) : (),
+ clean =>
+ {
+ FILES => 'blib/* Makefile MANIFEST String-Dirify-*'
+ },
+ dist =>
+ {
+ COMPRESS => 'gzip',
+ SUFFIX => 'gz'
+ },
+ DISTNAME => 'String-Dirify',
+ NAME => 'String::Dirify',
+ PL_FILES => {},
+ PREREQ_PM =>
+ {
+ Test::More => 0,
+ Test::Pod => 0,
+ },
+ VERSION_FROM => 'lib/String/Dirify.pm',
+);
Added: branches/upstream/libstring-dirify-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libstring-dirify-perl/current/README?rev=67070&op=file
==============================================================================
--- branches/upstream/libstring-dirify-perl/current/README (added)
+++ branches/upstream/libstring-dirify-perl/current/README Wed Jan 5 18:47:33 2011
@@ -1,0 +1,79 @@
+NAME
+ "String::Dirify" - Convert a string into a directory name
+
+Synopsis
+ use String::Dirify;
+
+ my($dir_1) = String::Dirify -> dirify('frobnitz');
+
+ Or:
+
+ use String::Dirify ':all';
+
+ my($dir_2) = dirify('bar baz');
+
+ Or even:
+
+ use String::Dirify;
+
+ my($sd) = String::Dirify -> new();
+ my($dir_3) = $sd -> dirify('!Q at W#E$R%T^Y');
+
+Description
+ "String::Dirify" is a pure Perl module.
+
+ This module allows you to convert a string (possibly containing high
+ ASCII characters, and even HTML) into another, lower-cased, string which
+ can be used as a directory name.
+
+ For usage, see the Synopsis.
+
+ This code is derived from similar code in Movable Type.
+
+Method: dirify($string [, $separator])
+ Returns a string, which can be used as a directory name.
+
+ The default separator is '_'.
+
+ Each run of spaces in the string is replaced by this separator.
+
+Algorithm
+ 1: Each high ASCII character is replaced by its normal equivalent
+ 2: The string is converted to lower case
+ 3: Any HTML (including HTML entities) in the string is removed
+ 4: Any characters which are not (Perl) words, spaces or hyphens, are
+ removed
+ 5: Runs of spaces are converted to the separator character
+ For more details about this character, see the discussion of the
+ dirify() method (above).
+
+Melody 'v' Movable Type
+ See http://openmelody.org for details.
+
+Backwards Compatibility with Movable Type
+ Unfortunately, Movable Type's usage of dirify() allows a fake separator
+ - '1' - to be used for the second parameter in the call to dirify().
+
+ The '1' triggered usage of '_' as the separator, rather than the '1'
+ provided.
+
+ This 'feature' has been preserved in "String::Dirify", but is
+ discouraged. Instead, simply drop the second parameter and let the code
+ default to '_'.
+
+Distributions
+ This module is available as a Unix-style distro (*.tgz).
+
+ See http://savage.net.au/Perl-modules.html for details.
+
+Authors
+ "String::Dirify" started out as part of Movable Type's code.
+
+ Then, Mark Stosberg cut down the original code to provide just the
+ English/ISO/ASCII features.
+
+ Lastly, the code was cleaned up, tests added, and all packaged, by Ron
+ Savage *<ron at savage.net.au>* in 2009.
+
+ Home page: http://savage.net.au/index.html
+
Added: branches/upstream/libstring-dirify-perl/current/lib/String/Dirify.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libstring-dirify-perl/current/lib/String/Dirify.pm?rev=67070&op=file
==============================================================================
--- branches/upstream/libstring-dirify-perl/current/lib/String/Dirify.pm (added)
+++ branches/upstream/libstring-dirify-perl/current/lib/String/Dirify.pm Wed Jan 5 18:47:33 2011
@@ -1,0 +1,278 @@
+package String::Dirify;
+
+use strict;
+use warnings;
+
+require Exporter;
+
+our @ISA = qw(Exporter);
+
+# 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 the declaration use String::Dirify ':all';
+# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
+# will save memory.
+our %EXPORT_TAGS = ( 'all' => [ qw(
+ dirify
+) ] );
+
+our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
+
+our @EXPORT = qw(
+
+);
+
+our $VERSION = '1.01';
+
+# ------------------------------------------------
+
+my(%high_ASCII_char) =
+(
+ "\xc0" => 'A', # A`
+ "\xe0" => 'a', # a`
+ "\xc1" => 'A', # A'
+ "\xe1" => 'a', # a'
+ "\xc2" => 'A', # A^
+ "\xe2" => 'a', # a^
+ "\xc4" => 'A', # A:
+ "\xe4" => 'a', # a:
+ "\xc5" => 'A', # Aring
+ "\xe5" => 'a', # aring
+ "\xc6" => 'AE', # AE
+ "\xe6" => 'ae', # ae
+ "\xc3" => 'A', # A~
+ "\xe3" => 'a', # a~
+ "\xc8" => 'E', # E`
+ "\xe8" => 'e', # e`
+ "\xc9" => 'E', # E'
+ "\xe9" => 'e', # e'
+ "\xca" => 'E', # E^
+ "\xea" => 'e', # e^
+ "\xcb" => 'E', # E:
+ "\xeb" => 'e', # e:
+ "\xcc" => 'I', # I`
+ "\xec" => 'i', # i`
+ "\xcd" => 'I', # I'
+ "\xed" => 'i', # i'
+ "\xce" => 'I', # I^
+ "\xee" => 'i', # i^
+ "\xcf" => 'I', # I:
+ "\xef" => 'i', # i:
+ "\xd2" => 'O', # O`
+ "\xf2" => 'o', # o`
+ "\xd3" => 'O', # O'
+ "\xf3" => 'o', # o'
+ "\xd4" => 'O', # O^
+ "\xf4" => 'o', # o^
+ "\xd6" => 'O', # O:
+ "\xf6" => 'o', # o:
+ "\xd5" => 'O', # O~
+ "\xf5" => 'o', # o~
+ "\xd8" => 'O', # O/
+ "\xf8" => 'o', # o/
+ "\xd9" => 'U', # U`
+ "\xf9" => 'u', # u`
+ "\xda" => 'U', # U'
+ "\xfa" => 'u', # u'
+ "\xdb" => 'U', # U^
+ "\xfb" => 'u', # u^
+ "\xdc" => 'U', # U:
+ "\xfc" => 'u', # u:
+ "\xc7" => 'C', # ,C
+ "\xe7" => 'c', # ,c
+ "\xd1" => 'N', # N~
+ "\xf1" => 'n', # n~
+ "\xdd" => 'Y', # Yacute
+ "\xfd" => 'y', # yacute
+ "\xdf" => 'ss', # szlig
+ "\xff" => 'y' # yuml
+);
+
+my($high_ASCII_re) = join '|', keys %high_ASCII_char;
+
+# ------------------------------------------------
+
+sub convert_high_ascii
+{
+ # require MT::I18N;
+ # MT::I18N::convert_high_ascii(@_);
+
+ my($self, $s) = @_;
+ $s =~ s/($high_ASCII_re)/$high_ASCII_char{$1}/g;
+
+ return $s;
+
+} # End of convert_high_ascii.
+
+# ------------------------------------------------
+# Re-use just the parts we need of Movable Type's 'dirify' function.
+# The purpose is to take any string and make it a valid directory name.
+
+sub dirify
+{
+ # ($MT::VERSION && MT->instance->{cfg}->PublishCharset =~ m/utf-?8/i)
+ # ? utf8_dirify(@_) : iso_dirify(@_);
+
+ my($self);
+
+ if (ref $_[0]) # Handle calls like $o = String::Dirify -> new(); $d = $o -> dirify($s).
+ {
+ $self = shift;
+ }
+ elsif ($_[0] eq __PACKAGE__) # Handle calls like $d = String::Dirify -> dirify($s).
+ {
+ $self = new(shift @_);
+ }
+ else # Handle calls like $d = dirify($s).
+ {
+ $self = new(__PACKAGE__);
+ }
+
+ return $self -> iso_dirify(@_);
+
+} # End of dirify.
+
+# ------------------------------------------------
+
+sub iso_dirify
+{
+ my($self, $s, $sep) = @_;
+
+ return '' if (! defined $s);
+
+ $sep = defined($sep) && ($sep ne '1') ? $sep : '_';
+ $s = $self -> convert_high_ascii($s); # Convert high-ASCII chars to 7-bit.
+ $s = $self -> remove_html(lc $s); # Lower case, and remove HTML tags.
+ $s =~ s!&[^;\s]+;!!gs; # Remove HTML entities.
+ $s =~ s![^\w\s-]!!gs; # Remove non-word/space chars.
+ $s =~ s!\s+!$sep!gs; # Change runs of spaces to the separator char.
+
+ return $s;
+
+} # End of iso_dirify.
+
+# ------------------------------------------------
+
+sub new
+{
+ my($class) = @_;
+
+ return bless {}, $class;
+
+} # End of new.
+
+# ------------------------------------------------
+
+sub remove_html
+{
+ my($self, $text) = @_;
+
+ return $text if (! defined $text); # Suppress warnings.
+ return $text if $text =~ m/^<\!\[CDATA\[/i; # We need /i because lc() has been called.
+
+ $text =~ s!<[^>]+>!!gs; # Remove all '<'s which have matching '>'s.
+ $text =~ s!<!<!gs; # Make remaining '<'s into entities, for iso_dirify() to zap.
+
+ return $text;
+
+} # End of remove_html.
+
+# ------------------------------------------------
+
+1;
+
+__END__
+
+=head1 NAME
+
+C<String::Dirify> - Convert a string into a directory name
+
+=head1 Synopsis
+
+ use String::Dirify;
+
+ my($dir_1) = String::Dirify -> dirify('frobnitz');
+
+Or:
+
+ use String::Dirify ':all';
+
+ my($dir_2) = dirify('bar baz');
+
+Or even:
+
+ use String::Dirify;
+
+ my($sd) = String::Dirify -> new();
+ my($dir_3) = $sd -> dirify('!Q at W#E$R%T^Y');
+
+=head1 Description
+
+C<String::Dirify> is a pure Perl module.
+
+This module allows you to convert a string (possibly containing high ASCII characters,
+and even HTML) into another, lower-cased, string which can be used as a directory name.
+
+For usage, see the Synopsis.
+
+This code is derived from similar code in Movable Type.
+
+=head1 Method: dirify($string [, $separator])
+
+Returns a string, which can be used as a directory name.
+
+The default separator is '_'.
+
+Each run of spaces in the string is replaced by this separator.
+
+=head1 Algorithm
+
+=over 4
+
+=item 1: Each high ASCII character is replaced by its normal equivalent
+
+=item 2: The string is converted to lower case
+
+=item 3: Any HTML (including HTML entities) in the string is removed
+
+=item 4: Any characters which are not (Perl) words, spaces or hyphens, are removed
+
+=item 5: Runs of spaces are converted to the separator character
+
+For more details about this character, see the discussion of the dirify() method (above).
+
+=back
+
+=head1 Melody 'v' Movable Type
+
+See http://openmelody.org for details.
+
+=head1 Backwards Compatibility with Movable Type
+
+Unfortunately, Movable Type's usage of dirify() allows a fake separator - '1' - to be used for the
+second parameter in the call to dirify().
+
+The '1' triggered usage of '_' as the separator, rather than the '1' provided.
+
+This 'feature' has been preserved in C<String::Dirify>, but is discouraged. Instead, simply drop the
+second parameter and let the code default to '_'.
+
+=head1 Distributions
+
+This module is available as a Unix-style distro (*.tgz).
+
+See http://savage.net.au/Perl-modules.html for details.
+
+=head1 Authors
+
+C<String::Dirify> started out as part of Movable Type's code.
+
+Then, Mark Stosberg cut down the original code to provide just the English/ISO/ASCII features.
+
+Lastly, the code was cleaned up, tests added, and all packaged, by Ron Savage I<E<lt>ron at savage.net.auE<gt>> in 2009.
+
+Home page: http://savage.net.au/index.html
+
+=cut
Added: branches/upstream/libstring-dirify-perl/current/t/general.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libstring-dirify-perl/current/t/general.t?rev=67070&op=file
==============================================================================
--- branches/upstream/libstring-dirify-perl/current/t/general.t (added)
+++ branches/upstream/libstring-dirify-perl/current/t/general.t Wed Jan 5 18:47:33 2011
@@ -1,0 +1,11 @@
+use Test::More tests => 6;
+
+BEGIN{ use_ok('String::Dirify'); }
+
+my($sd) = String::Dirify -> new();
+
+ok($sd -> dirify("\xc0\xe0\xdf\xff\xd4") eq 'aassyo', 'Test 2: High ASCII chars');
+ok($sd -> dirify('!Q at W#E$R%T^Y') eq 'qwerty', 'Test 3: Punctuation');
+ok($sd -> dirify('<html>html&ok</html>') eq 'htmlok', 'Test 4: HTML');
+ok($sd -> dirify('<![CDATA[x]]>') eq 'cdatax', 'Test 5: CDATA');
+ok(String::Dirify -> dirify('not.obj') eq 'notobj', 'Test 6: Object-free');
Propchange: branches/upstream/libstring-dirify-perl/current/t/general.t
------------------------------------------------------------------------------
svn:executable =
Added: branches/upstream/libstring-dirify-perl/current/t/import.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libstring-dirify-perl/current/t/import.t?rev=67070&op=file
==============================================================================
--- branches/upstream/libstring-dirify-perl/current/t/import.t (added)
+++ branches/upstream/libstring-dirify-perl/current/t/import.t Wed Jan 5 18:47:33 2011
@@ -1,0 +1,7 @@
+use Test::More tests => 4;
+use String::Dirify ':all';
+
+ok(dirify("\xc0\xe0\xdf\xff\xd4") eq 'aassyo', 'Test 1: High ASCII chars');
+ok(dirify('!Q at W#E$R%T^Y') eq 'qwerty', 'Test 2: Punctuation');
+ok(dirify('<html>html&ok</html>') eq 'htmlok', 'Test 3: HTML');
+ok(dirify('<![CDATA[x]]>') eq 'cdatax', 'Test 4: CDATA');
Propchange: branches/upstream/libstring-dirify-perl/current/t/import.t
------------------------------------------------------------------------------
svn:executable =
Added: branches/upstream/libstring-dirify-perl/current/t/pod.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libstring-dirify-perl/current/t/pod.t?rev=67070&op=file
==============================================================================
--- branches/upstream/libstring-dirify-perl/current/t/pod.t (added)
+++ branches/upstream/libstring-dirify-perl/current/t/pod.t Wed Jan 5 18:47:33 2011
@@ -1,0 +1,7 @@
+use Test::More;
+
+eval "use Test::Pod 1.00";
+
+plan skip_all => "Test::Pod 1.00 required for testing POD" if $@;
+
+all_pod_files_ok();
Propchange: branches/upstream/libstring-dirify-perl/current/t/pod.t
------------------------------------------------------------------------------
svn:executable =
Added: branches/upstream/libstring-dirify-perl/current/t/separator.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libstring-dirify-perl/current/t/separator.t?rev=67070&op=file
==============================================================================
--- branches/upstream/libstring-dirify-perl/current/t/separator.t (added)
+++ branches/upstream/libstring-dirify-perl/current/t/separator.t Wed Jan 5 18:47:33 2011
@@ -1,0 +1,6 @@
+use Test::More tests => 3;
+use String::Dirify 'dirify';
+
+ok(dirify(" \xc0\xe0\xdf\xff\xd4", 1) eq '_aassyo', 'Test 1: High ASCII chars');
+ok(dirify(' !Q at W#E$R%T^Y', '_') eq '_qwerty', 'Test 2: Punctuation');
+ok(dirify(' <html>html&ok</html>', 'x') eq 'xhtmlok', 'Test 3: HTML');
Propchange: branches/upstream/libstring-dirify-perl/current/t/separator.t
------------------------------------------------------------------------------
svn:executable =
More information about the Pkg-perl-cvs-commits
mailing list