r3885 - in /packages/liblingua-en-numbers-ordinate-perl: ./
branches/ branches/upstream/ branches/upstream/current/
branches/upstream/current/lib/ branches/upstream/current/lib/Lingua/
branches/upstream/current/lib/Lingua/EN/
branches/upstream/current/lib/Lingua/EN/Numbers/
branches/upstream/current/t/ tags/
gwolf at users.alioth.debian.org
gwolf at users.alioth.debian.org
Thu Sep 21 23:29:52 UTC 2006
Author: gwolf
Date: Thu Sep 21 23:29:52 2006
New Revision: 3885
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=3885
Log:
[svn-inject] Installing original source of liblingua-en-numbers-ordinate-perl
Added:
packages/liblingua-en-numbers-ordinate-perl/
packages/liblingua-en-numbers-ordinate-perl/branches/
packages/liblingua-en-numbers-ordinate-perl/branches/upstream/
packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/
packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/ChangeLog
packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/MANIFEST
packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/MANIFEST.SKIP
packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/META.yml
packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/Makefile.PL
packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/README
packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/lib/
packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/lib/Lingua/
packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/lib/Lingua/EN/
packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/lib/Lingua/EN/Numbers/
packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/lib/Lingua/EN/Numbers/Ordinate.pm
packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/t/
packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/t/00_about_verbose.t
packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/t/01_old_junk.t
packages/liblingua-en-numbers-ordinate-perl/tags/
Added: packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/ChangeLog
URL: http://svn.debian.org/wsvn/pkg-perl/packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/ChangeLog?rev=3885&op=file
==============================================================================
--- packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/ChangeLog (added)
+++ packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/ChangeLog Thu Sep 21 23:29:52 2006
@@ -1,0 +1,11 @@
+Revision history for Perl extension Lingua::EN::Numbers::Ordinate
+ Time-stamp: "2004-12-29 19:06:10 AST"
+
+2004-12-29 Sean M. Burke sburke at cpan.org
+
+ * Release 1.02 -- no code changes, just rebundling
+
+2000-08-24 Sean M. Burke sburke at cpan.org
+
+ * Release 0.01 -- first release
+
Added: packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/MANIFEST?rev=3885&op=file
==============================================================================
--- packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/MANIFEST (added)
+++ packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/MANIFEST Thu Sep 21 23:29:52 2006
@@ -1,0 +1,9 @@
+ChangeLog
+lib/Lingua/EN/Numbers/Ordinate.pm
+Makefile.PL
+MANIFEST
+MANIFEST.SKIP
+README
+t/00_about_verbose.t
+t/01_old_junk.t
+META.yml Module meta-data (added by MakeMaker)
Added: packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/MANIFEST.SKIP
URL: http://svn.debian.org/wsvn/pkg-perl/packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/MANIFEST.SKIP?rev=3885&op=file
==============================================================================
--- packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/MANIFEST.SKIP (added)
+++ packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/MANIFEST.SKIP Thu Sep 21 23:29:52 2006
@@ -1,0 +1,7 @@
+^MANIFEST\.bak$
+Makefile(\.old)?$
+\.rej$
+CVS
+blib
+~
+
Added: packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/META.yml?rev=3885&op=file
==============================================================================
--- packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/META.yml (added)
+++ packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/META.yml Thu Sep 21 23:29:52 2006
@@ -1,0 +1,10 @@
+# http://module-build.sourceforge.net/META-spec.html
+#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
+name: Lingua-EN-Numbers-Ordinate
+version: 1.02
+version_from: lib/Lingua/EN/Numbers/Ordinate.pm
+installdirs: site
+requires:
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.17
Added: packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/Makefile.PL?rev=3885&op=file
==============================================================================
--- packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/Makefile.PL (added)
+++ packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/Makefile.PL Thu Sep 21 23:29:52 2006
@@ -1,0 +1,16 @@
+# This -*-perl-*- script writes the Makefile for installing this distribution.
+#
+# See "perldoc perlmodinstall" or "perldoc ExtUtils::MakeMaker" for
+# info on how to control how the installation goes.
+#
+# Time-stamp: "2004-12-29 20:19:53 AST"
+
+require 5.004;
+use strict;
+use ExtUtils::MakeMaker;
+
+WriteMakefile(
+ 'NAME' => 'Lingua::EN::Numbers::Ordinate',
+ 'VERSION_FROM' => 'lib/Lingua/EN/Numbers/Ordinate.pm', # finds $VERSION
+ 'dist' => { COMPRESS => 'gzip -6f', SUFFIX => 'gz', },
+);
Added: packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/README?rev=3885&op=file
==============================================================================
--- packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/README (added)
+++ packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/README Thu Sep 21 23:29:52 2006
@@ -1,0 +1,184 @@
+README for Lingua::EN::Numbers::Ordinate
+ Time-stamp: "2000-08-24 16:59:23 MDT"
+
+ Lingua::EN::Numbers::Ordinate
+
+[Partially excerpted from the POD.]
+
+
+ Lingua::EN::Numbers::Ordinate -- go from cardinal number (3)
+ to ordinal ("3rd")
+
+SYNOPSIS
+ use Lingua::EN::Numbers::Ordinate;
+ print ordinate(4), "\n";
+ # prints 4th
+ print ordinate(-342), "\n";
+ # prints -342nd
+
+ # Example of actual use:
+ ...
+ for(my $i = 0; $i < @records; $i++) {
+ unless(is_valid($record[$i]) {
+ warn "The ", ordinate($i), " record is invalid!\n";
+ next;
+ }
+ ...
+ }
+
+DESCRIPTION
+ There are two kinds of numbers in English -- cardinals (1,
+ 2, 3...), and ordinals (1st, 2nd, 3rd...). This library
+ provides functions for giving the ordinal form of a number,
+ given its cardinal value.
+
+FUNCTIONS
+ ordinate(SCALAR)
+ Returns a string consisting of that scalar's string
+ form, plus the appropriate ordinal suffix. Example:
+ ordinate(23) returns "23rd".
+
+ As a special case, ordinate(undef) and ordinate("")
+ return "0th", not "th".
+
+ This function is exported by default.
+
+ th(SCALAR)
+ Merely an alias for ordinate, but not exported by
+ default.
+
+ ordsuf(SCALAR)
+ Returns just the appropriate ordinal suffix for the
+ given scalar numeric value. This is what ordinate uses
+ to actually do its work. For example, ordsuf(3) is
+ "rd".
+
+ Not exported by default.
+
+ The above functions are all prototyped to take a scalar
+ value, so ordinate(@stuff) is the same as ordinate(scalar
+ @stuff).
+
+CAVEATS
+ * Note that this library knows only about numbers, not
+ number-words. ordinate('seven') might just as well be
+ ordinate('superglue') or ordinate("\x1E\x9A") -- you'll get
+ the fallthru case of the input string plus "th".
+
+ * As is unavoidable, ordinate(0256) returns "174th" (because
+ ordinate sees the value 174). Similarly, ordinate(1E12)
+ returns "1000000000000th". Returning "trillionth" would be
+ nice, but that's an awfully atypical case.
+
+ * Note that this library's algorithm (as well as the basic
+ concept and implementation of ordinal numbers) is totally
+ language specific.
+
+ To pick a trivial example, consider that in French, 1
+ ordinates as "1ier", whereas 41 ordinates as "41ieme".
+
+STILL NOT SATISFIED?
+ Bored of this...?
+
+ use Lingua::EN::Numbers::Ordinate qw(ordinate th);
+ ...
+ print th($n), " entry processed...\n";
+ ...
+
+ Try this bit of lunacy:
+
+ {
+ my $th_object;
+ sub _th () { $th_object }
+
+ package Lingua::EN::Numbers::Ordinate::Overloader;
+ my $x; # Gotta have something to bless.
+ $th_object = bless \$x; # Define the object now, which _th returns
+ use Carp ();
+ use Lingua::EN::Numbers::Ordinate ();
+ sub overordinate {
+ Carp::croak "_th should be used only as postfix!" unless $_[2];
+ Lingua::EN::Numbers::Ordinate::ordinate($_[1]);
+ }
+ use overload '&' => \&overordinate;
+ }
+
+ Then you get to do:
+
+ print 3 & _th, "\n";
+ # prints "3rd"
+
+ print 1 + 2 & _th, "\n";
+ # prints "3rd" too!
+ # Because of the precedence of & !
+
+ print _th & 3, "\n";
+ # dies with: "th should be used only as postfix!"
+
+ Kooky, isn't it? For more delightful deleria like this, see
+ Damian Conway's Object Oriented Perl from Manning Press.
+
+ Kinda makes you like th(3), doesn't it?
+
+COPYRIGHT
+ Copyright (c) 2000 Sean M. Burke. All rights reserved.
+
+ This library is free software; you can redistribute it
+ and/or modify it under the same terms as Perl itself.
+
+AUTHOR
+ Sean M. Burke sburke at cpan.org
+
+
+[End of POD excerpt]
+
+PREREQUISITES
+
+This suite requires Perl 5; I've only used it under Perl 5.004, so for
+anything lower, you're on your own.
+
+Lingua::EN::Numbers::Ordinate doesn't use any nonstandard modules.
+
+
+INSTALLATION
+
+You install Lingua::EN::Numbers::Ordinate, as you would install any
+perl module library, by running these commands:
+
+ perl Makefile.PL
+ make
+ make test
+ make install
+
+If you want to install a private copy of Lingua::EN::Numbers::Ordinate
+in your home directory, then you should try to produce the initial
+Makefile with something like this command:
+
+ perl Makefile.PL LIB=~/perl
+
+
+DOCUMENTATION
+
+POD-format documentation is included in Ordinate.pm. POD is readable
+with the 'perldoc' utility. See ChangeLog for recent changes.
+
+
+MACPERL INSTALLATION NOTES
+
+You needn't bother with the makefiles. Just make a Lingua directory
+in your MacPerl site_lib or lib directory, an EN directory under that,
+and a Numbers directory under that, and move Ordinate.pm into there.
+
+
+SUPPORT
+
+Questions, bug reports, useful code bits, and suggestions for
+Lingua::EN::Numbers::Ordinate should just be sent to me at sburke at cpan.org
+
+
+AVAILABILITY
+
+The latest version of Lingua::EN::Numbers::Ordinate is available from the
+Comprehensive Perl Archive Network (CPAN). Visit
+<http://www.perl.com/CPAN/> to find a CPAN site near you.
+
Added: packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/lib/Lingua/EN/Numbers/Ordinate.pm
URL: http://svn.debian.org/wsvn/pkg-perl/packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/lib/Lingua/EN/Numbers/Ordinate.pm?rev=3885&op=file
==============================================================================
--- packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/lib/Lingua/EN/Numbers/Ordinate.pm (added)
+++ packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/lib/Lingua/EN/Numbers/Ordinate.pm Thu Sep 21 23:29:52 2006
@@ -1,0 +1,175 @@
+
+require 5;
+package Lingua::EN::Numbers::Ordinate;
+use strict;
+# Time-stamp: "2004-12-29 19:06:20 AST"
+use vars qw(@ISA @EXPORT @EXPORT_OK $VERSION);
+require Exporter;
+ at ISA = ('Exporter');
+ at EXPORT = ('ordinate');
+ at EXPORT_OK = ('ordsuf', 'th');
+$VERSION = "1.02";
+
+###########################################################################
+
+=head1 NAME
+
+Lingua::EN::Numbers::Ordinate -- go from cardinal number (3) to ordinal ("3rd")
+
+=head1 SYNOPSIS
+
+ use Lingua::EN::Numbers::Ordinate;
+ print ordinate(4), "\n";
+ # prints 4th
+ print ordinate(-342), "\n";
+ # prints -342nd
+
+ # Example of actual use:
+ ...
+ for(my $i = 0; $i < @records; $i++) {
+ unless(is_valid($record[$i]) {
+ warn "The ", ordinate($i), " record is invalid!\n";
+ next;
+ }
+ ...
+ }
+
+=head1 DESCRIPTION
+
+There are two kinds of numbers in English -- cardinals (1, 2, 3...), and
+ordinals (1st, 2nd, 3rd...). This library provides functions for giving
+the ordinal form of a number, given its cardinal value.
+
+=head1 FUNCTIONS
+
+=over
+
+=item ordinate(SCALAR)
+
+Returns a string consisting of that scalar's string form, plus the
+appropriate ordinal suffix. Example: C<ordinate(23)> returns "23rd".
+
+As a special case, C<ordinate(undef)> and C<ordinate("")> return "0th",
+not "th".
+
+This function is exported by default.
+
+=item th(SCALAR)
+
+Merely an alias for C<ordinate>, but not exported by default.
+
+=item ordsuf(SCALAR)
+
+Returns just the appropriate ordinal suffix for the given scalar
+numeric value. This is what C<ordinate> uses to actually do its
+work. For example, C<ordsuf(3)> is "rd".
+
+Not exported by default.
+
+=back
+
+The above functions are all prototyped to take a scalar value,
+so C<ordinate(@stuff)> is the same as C<ordinate(scalar @stuff)>.
+
+=head1 CAVEATS
+
+* Note that this library knows only about numbers, not number-words.
+C<ordinate('seven')> might just as well be C<ordinate('superglue')>
+or C<ordinate("\x1E\x9A")> -- you'll get the fallthru case of the input
+string plus "th".
+
+* As is unavoidable, C<ordinate(0256)> returns "174th" (because ordinate
+sees the value 174). Similarly, C<ordinate(1E12)> returns
+"1000000000000th". Returning "trillionth" would be nice, but that's an
+awfully atypical case.
+
+* Note that this library's algorithm (as well as the basic concept
+and implementation of ordinal numbers) is totally language specific.
+
+To pick a trivial example, consider that in French, 1 ordinates
+as "1ier", whereas 41 ordinates as "41ieme".
+
+=head1 STILL NOT SATISFIED?
+
+Bored of this...?
+
+ use Lingua::EN::Numbers::Ordinate qw(ordinate th);
+ ...
+ print th($n), " entry processed...\n";
+ ...
+
+Try this bit of lunacy:
+
+ {
+ my $th_object;
+ sub _th () { $th_object }
+
+ package Lingua::EN::Numbers::Ordinate::Overloader;
+ my $x; # Gotta have something to bless.
+ $th_object = bless \$x; # Define the object now, which _th returns
+ use Carp ();
+ use Lingua::EN::Numbers::Ordinate ();
+ sub overordinate {
+ Carp::croak "_th should be used only as postfix!" unless $_[2];
+ Lingua::EN::Numbers::Ordinate::ordinate($_[1]);
+ }
+ use overload '&' => \&overordinate;
+ }
+
+Then you get to do:
+
+ print 3 & _th, "\n";
+ # prints "3rd"
+
+ print 1 + 2 & _th, "\n";
+ # prints "3rd" too!
+ # Because of the precedence of & !
+
+ print _th & 3, "\n";
+ # dies with: "th should be used only as postfix!"
+
+Kooky, isn't it? For more delightful deleria like this, see
+Damian Conway's I<Object Oriented Perl> from Manning Press.
+
+Kinda makes you like C<th(3)>, doesn't it?
+
+=head1 COPYRIGHT
+
+Copyright (c) 2000 Sean M. Burke. All rights reserved.
+
+This library is free software; you can redistribute it and/or
+modify it under the same terms as Perl itself.
+
+=head1 AUTHOR
+
+Sean M. Burke C<sburke at cpan.org>
+
+=cut
+
+###########################################################################
+
+sub ordsuf ($) {
+ return 'th' if not(defined($_[0])) or not( 0 + $_[0] );
+ # 'th' for undef, 0, or anything non-number.
+ my $n = abs($_[0]); # Throw away the sign.
+ return 'th' unless $n == int($n); # Best possible, I guess.
+ $n %= 100;
+ return 'th' if $n == 11 or $n == 12 or $n == 13;
+ $n %= 10;
+ return 'st' if $n == 1;
+ return 'nd' if $n == 2;
+ return 'rd' if $n == 3;
+ return 'th';
+}
+
+sub ordinate ($) {
+ my $i = $_[0] || 0;
+ return $i . ordsuf($i);
+}
+
+*th = \&ordinate; # correctly copies the prototype, too.
+
+###########################################################################
+1;
+
+__END__
Added: packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/t/00_about_verbose.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/t/00_about_verbose.t?rev=3885&op=file
==============================================================================
--- packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/t/00_about_verbose.t (added)
+++ packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/t/00_about_verbose.t Thu Sep 21 23:29:52 2006
@@ -1,0 +1,85 @@
+
+require 5;
+# Time-stamp: "2004-12-29 20:54:50 AST"
+# Summary of, well, things.
+
+use Test;
+BEGIN {plan tests => 2};
+ok 1;
+
+use Lingua::EN::Numbers::Ordinate ();
+
+#chdir "t" if -e "t";
+
+{
+ my @out;
+ push @out,
+ "\n\nPerl v",
+ defined($^V) ? sprintf('%vd', $^V) : $],
+ " under $^O ",
+ (defined(&Win32::BuildNumber) and defined &Win32::BuildNumber())
+ ? ("(Win32::BuildNumber ", &Win32::BuildNumber(), ")") : (),
+ (defined $MacPerl::Version)
+ ? ("(MacPerl version $MacPerl::Version)") : (),
+ "\n"
+ ;
+
+ # Ugly code to walk the symbol tables:
+ my %v;
+ my @stack = (''); # start out in %::
+ my $this;
+ my $count = 0;
+ my $pref;
+ while(@stack) {
+ $this = shift @stack;
+ die "Too many packages?" if ++$count > 1000;
+ next if exists $v{$this};
+ next if $this eq 'main'; # %main:: is %::
+
+ #print "Peeking at $this => ${$this . '::VERSION'}\n";
+
+ if(defined ${$this . '::VERSION'} ) {
+ $v{$this} = ${$this . '::VERSION'}
+ } elsif(
+ defined *{$this . '::ISA'} or defined &{$this . '::import'}
+ or ($this ne '' and grep defined *{$_}{'CODE'}, values %{$this . "::"})
+ # If it has an ISA, an import, or any subs...
+ ) {
+ # It's a class/module with no version.
+ $v{$this} = undef;
+ } else {
+ # It's probably an unpopulated package.
+ ## $v{$this} = '...';
+ }
+
+ $pref = length($this) ? "$this\::" : '';
+ push @stack, map m/^(.+)::$/ ? "$pref$1" : (), keys %{$this . '::'};
+ #print "Stack: @stack\n";
+ }
+ push @out, " Modules in memory:\n";
+ delete @v{'', '[none]'};
+ foreach my $p (sort {lc($a) cmp lc($b)} keys %v) {
+ $indent = ' ' x (2 + ($p =~ tr/:/:/));
+ push @out, ' ', $indent, $p, defined($v{$p}) ? " v$v{$p};\n" : ";\n";
+ }
+ push @out, sprintf "[at %s (local) / %s (GMT)]\n",
+ scalar(gmtime), scalar(localtime);
+ my $x = join '', @out;
+ $x =~ s/^/#/mg;
+ print $x;
+}
+
+print "# Running",
+ (chr(65) eq 'A') ? " in an ASCII world.\n" : " in a non-ASCII world.\n",
+ "#\n",
+;
+
+print "# \@INC:\n", map("# [$_]\n", @INC), "#\n#\n";
+
+print "# \%INC:\n";
+foreach my $x (sort {lc($a) cmp lc($b)} keys %INC) {
+ print "# [$x] = [", $INC{$x} || '', "]\n";
+}
+
+ok 1;
+
Added: packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/t/01_old_junk.t
URL: http://svn.debian.org/wsvn/pkg-perl/packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/t/01_old_junk.t?rev=3885&op=file
==============================================================================
--- packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/t/01_old_junk.t (added)
+++ packages/liblingua-en-numbers-ordinate-perl/branches/upstream/current/t/01_old_junk.t Thu Sep 21 23:29:52 2006
@@ -1,0 +1,21 @@
+
+# Time-stamp: "2004-12-29 18:48:49 AST"
+
+use strict;
+use Test;
+BEGIN { plan tests => 14 };
+use Lingua::EN::Numbers::Ordinate;
+ok 1;
+ok ordinate(3), '3rd';
+ok ordinate(-3), '-3rd';
+ok ordinate(13), '13th';
+ok ordinate(33), '33rd';
+ok ordinate(-513), '-513th';
+ok ordinate(1), '1st';
+ok ordinate(2), '2nd';
+ok ordinate(4), '4th';
+ok ordinate(5), '5th';
+ok ordinate(0), '0th';
+ok ordinate(''), '0th';
+ok ordinate(undef), '0th';
+ok ordinate(22), '22nd';
More information about the Pkg-perl-cvs-commits
mailing list