r37896 - in /branches/upstream/libuniversal-moniker-perl: ./ current/ current/Changes current/MANIFEST current/META.yml current/Makefile.PL current/README current/moniker.pm current/t/ current/t/moniker.t
bartm at users.alioth.debian.org
bartm at users.alioth.debian.org
Tue Jun 9 07:14:41 UTC 2009
Author: bartm
Date: Tue Jun 9 07:13:10 2009
New Revision: 37896
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=37896
Log:
[svn-inject] Installing original source of libuniversal-moniker-perl
Added:
branches/upstream/libuniversal-moniker-perl/
branches/upstream/libuniversal-moniker-perl/current/
branches/upstream/libuniversal-moniker-perl/current/Changes
branches/upstream/libuniversal-moniker-perl/current/MANIFEST
branches/upstream/libuniversal-moniker-perl/current/META.yml
branches/upstream/libuniversal-moniker-perl/current/Makefile.PL
branches/upstream/libuniversal-moniker-perl/current/README
branches/upstream/libuniversal-moniker-perl/current/moniker.pm
branches/upstream/libuniversal-moniker-perl/current/t/
branches/upstream/libuniversal-moniker-perl/current/t/moniker.t
Added: branches/upstream/libuniversal-moniker-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libuniversal-moniker-perl/current/Changes?rev=37896&op=file
==============================================================================
--- branches/upstream/libuniversal-moniker-perl/current/Changes (added)
+++ branches/upstream/libuniversal-moniker-perl/current/Changes Tue Jun 9 07:13:10 2009
@@ -1,0 +1,15 @@
+0.08 Wed Jul 21 15:54:27 BST 2004
+ * qualified 'require' as 'CORE::require' to prevent warnings when using
+ UNIVERSAL::require
+0.07 Tue Feb 24 18:07:50 GMT 2004
+ * added this Changes file; I never would have guessed that I needed one for
+ such a small module.
+ * Included a performance improvement from Elizabeth Mattijsen. Thanks.
+0.06 Fri Sep 05 sometime 2003
+ * make the tests pass if Lingua::EN::Inflect isn't installed.
+0.05 Thu Sep 04 sometime 2003
+ * removed Lingua::EN::Inflect from the prerequisite list; if you want
+ plurals, you must install it yourself.
+0.04 ???
+ * removed the "use warnings" so it will work with older Perl versions;
+ Thanks to Schwern and Miyagawa.
Added: branches/upstream/libuniversal-moniker-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libuniversal-moniker-perl/current/MANIFEST?rev=37896&op=file
==============================================================================
--- branches/upstream/libuniversal-moniker-perl/current/MANIFEST (added)
+++ branches/upstream/libuniversal-moniker-perl/current/MANIFEST Tue Jun 9 07:13:10 2009
@@ -1,0 +1,7 @@
+Changes
+Makefile.PL
+MANIFEST
+moniker.pm
+README
+t/moniker.t
+META.yml Module meta-data (added by MakeMaker)
Added: branches/upstream/libuniversal-moniker-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libuniversal-moniker-perl/current/META.yml?rev=37896&op=file
==============================================================================
--- branches/upstream/libuniversal-moniker-perl/current/META.yml (added)
+++ branches/upstream/libuniversal-moniker-perl/current/META.yml Tue Jun 9 07:13:10 2009
@@ -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: UNIVERSAL-moniker
+version: 0.08
+version_from: moniker.pm
+installdirs: site
+requires:
+
+distribution_type: module
+generated_by: ExtUtils::MakeMaker version 6.17
Added: branches/upstream/libuniversal-moniker-perl/current/Makefile.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libuniversal-moniker-perl/current/Makefile.PL?rev=37896&op=file
==============================================================================
--- branches/upstream/libuniversal-moniker-perl/current/Makefile.PL (added)
+++ branches/upstream/libuniversal-moniker-perl/current/Makefile.PL Tue Jun 9 07:13:10 2009
@@ -1,0 +1,15 @@
+#!/usr/bin/perl -w
+use ExtUtils::MakeMaker;
+
+warn <<"EOT";
+Hello!
+
+We no longer depend on Lingua::EN::Inflect.
+If you care about plurals, you should install it.
+
+EOT
+
+WriteMakefile(
+ 'NAME' => 'UNIVERSAL::moniker',
+ 'VERSION_FROM' => 'moniker.pm',
+);
Added: branches/upstream/libuniversal-moniker-perl/current/README
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libuniversal-moniker-perl/current/README?rev=37896&op=file
==============================================================================
--- branches/upstream/libuniversal-moniker-perl/current/README (added)
+++ branches/upstream/libuniversal-moniker-perl/current/README Tue Jun 9 07:13:10 2009
@@ -1,0 +1,68 @@
+In object oriented abstractions you often model real things as Perl classes.
+Unfortunately, the Perl classes have uglier names than the real things do.
+
+For example, I might model a customer using a Foo::Customer class.
+
+It would be useful if the Foo::Customer class knew what I would call its
+associated real thing.
+
+UNIVERSAL::moniker enables classes to make a good guess at what they would be
+called in the real world.
+
+ Foo::User->moniker eq "user";
+
+ my $a = Big::Scary::Animal->new;
+ $c->moniker eq "animal";
+
+ my $o = Cephalopod::Octopus->new;
+ $o->plural_moniker eq "octopuses";
+
+==============================================================================
+
+NAME
+ UNIVERSAL::moniker
+
+SYNOPSIS
+ use UNIVERSAL::moniker;
+
+DESCRIPTION
+ Class names in Perl often don't sound great when spoken, or look good
+ when written in prose. For this reason, we tend to say things like
+ "customer" or "basket" when we are referring to
+ "My::Site::User::Customer" or "My::Site::Shop::Basket". We thought it
+ would be nice if our classes knew what we would prefer to call them.
+
+ This module will add a "moniker" (and "plural_moniker") method to
+ "UNIVERSAL", and so to every class or module.
+
+ moniker
+ $ob->moniker;
+
+ Returns the moniker for $ob. So, if $ob->isa("Big::Scary::Animal"),
+ "moniker" will return "animal".
+
+ plural_moniker
+ $ob->plural_moniker;
+
+ Returns the plural moniker for $ob. So, if
+ $ob->isa("Cephalopod::Octopus"), "plural_moniker" will return
+ "octopuses".
+
+ (You need to install Lingua::EN::Inflect for this to work.)
+
+AUTHORS
+ Marty Pauley <marty+perl at kasei.com>, Tony Bowden <tony at kasei.com>,
+ Elizabeth Mattijsen <liz at dijkmat.nl>
+
+ (Yes, 3 authors for such a small module!)
+
+COPYRIGHT
+ Copyright (C) 2004 Kasei
+
+ This program is free software; you can redistribute it under the same terms as
+ Perl.
+
+ 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.
+
Added: branches/upstream/libuniversal-moniker-perl/current/moniker.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libuniversal-moniker-perl/current/moniker.pm?rev=37896&op=file
==============================================================================
--- branches/upstream/libuniversal-moniker-perl/current/moniker.pm (added)
+++ branches/upstream/libuniversal-moniker-perl/current/moniker.pm Tue Jun 9 07:13:10 2009
@@ -1,0 +1,75 @@
+package UNIVERSAL::moniker;
+$UNIVERSAL::moniker::VERSION = '0.08';
+
+=head1 NAME
+
+UNIVERSAL::moniker
+
+=head1 SYNOPSIS
+
+ use UNIVERSAL::moniker;
+
+=head1 DESCRIPTION
+
+Class names in Perl often don't sound great when spoken, or look good when
+written in prose. For this reason, we tend to say things like "customer" or
+"basket" when we are referring to C<My::Site::User::Customer> or
+C<My::Site::Shop::Basket>. We thought it would be nice if our classes knew what
+we would prefer to call them.
+
+This module will add a C<moniker> (and C<plural_moniker>) method to
+C<UNIVERSAL>, and so to every class or module.
+
+=head2 moniker
+
+ $ob->moniker;
+
+Returns the moniker for $ob.
+So, if $ob->isa("Big::Scary::Animal"), C<moniker> will return "animal".
+
+=head2 plural_moniker
+
+ $ob->plural_moniker;
+
+Returns the plural moniker for $ob.
+So, if $ob->isa("Cephalopod::Octopus"), C<plural_moniker> will return "octopuses".
+
+(You need to install Lingua::EN::Inflect for this to work.)
+
+=cut
+
+package UNIVERSAL;
+
+sub moniker {
+ (ref( $_[0] ) || $_[0]) =~ /([^:]+)$/;
+ return lc $1;
+}
+
+sub plural_moniker {
+ CORE::require Lingua::EN::Inflect;
+ return Lingua::EN::Inflect::PL($_[0]->moniker);
+}
+
+=head1 AUTHORS
+
+Marty Pauley <marty+perl at kasei.com>,
+Tony Bowden <tony at kasei.com>,
+Elizabeth Mattijsen <liz at dijkmat.nl>
+
+(Yes, 3 authors for such a small module!)
+
+=head1 COPYRIGHT
+
+ Copyright (C) 2004 Kasei
+
+ This program is free software; you can redistribute it under the same terms as
+ Perl.
+
+ 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.
+
+=cut
+
+
+1;
Added: branches/upstream/libuniversal-moniker-perl/current/t/moniker.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libuniversal-moniker-perl/current/t/moniker.t?rev=37896&op=file
==============================================================================
--- branches/upstream/libuniversal-moniker-perl/current/t/moniker.t (added)
+++ branches/upstream/libuniversal-moniker-perl/current/t/moniker.t Tue Jun 9 07:13:10 2009
@@ -1,0 +1,12 @@
+#!/usr/bin/perl
+use Test::More tests => 4;
+
+require_ok 'UNIVERSAL::moniker';
+is Bpm::User->moniker, "user";
+is +(bless {}, "Bpm::Customer")->moniker, "customer";
+
+SKIP: {
+ skip "You don't seem to have Lingua::EN::Inflect installed", 1
+ unless eval {require Lingua::EN::Inflect};
+ is Bpm::Octopus->plural_moniker, "octopuses";
+}
More information about the Pkg-perl-cvs-commits
mailing list