[libtype-tiny-perl] 05/14: rename Types::Datetime to Example::Types because there is now really a Types::DateTime on CPAN
Jonas Smedegaard
dr at jones.dk
Fri May 30 17:41:31 UTC 2014
This is an automated email from the git hooks/post-receive script.
js pushed a commit to tag 0.043_03
in repository libtype-tiny-perl.
commit 5df25ac5e48ac994c16e48d9b3fde011360e90c3
Author: Toby Inkster <mail at tobyinkster.co.uk>
Date: Sat Apr 26 16:01:05 2014 +0100
rename Types::Datetime to Example::Types because there is now really a Types::DateTime on CPAN
---
examples/datetime-coercions.pl | 8 ++++----
lib/Type/Tiny/Manual/Libraries.pod | 19 ++++++++-----------
2 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/examples/datetime-coercions.pl b/examples/datetime-coercions.pl
index 567ffc6..3a75398 100644
--- a/examples/datetime-coercions.pl
+++ b/examples/datetime-coercions.pl
@@ -4,7 +4,7 @@
=head1 PURPOSE
-This example expands upon the Types::Datetime library defined in
+This example expands upon the Example::Types library defined in
L<Type::Tiny::Manual::Libraries>. It defines class types for L<DateTime>
and L<DateTime::Duration> and some structured types for hashes that
can be used to instantiate DateTime objects. It defines some coercions
@@ -37,7 +37,7 @@ use warnings;
use lib "lib", "../lib";
BEGIN {
- package Types::Datetime;
+ package Example::Types;
use Type::Library
-base,
@@ -76,7 +76,7 @@ BEGIN {
from DatetimeHash, via { "DateTime"->new(%$_) },
from EpochHash, via { "DateTime"->from_epoch(%$_) };
- $INC{"Types/Datetime.pm"} = __FILE__;
+ $INC{"Example/Types.pm"} = __FILE__;
};
BEGIN {
@@ -84,7 +84,7 @@ BEGIN {
use Moose;
use Types::Standard qw( Str Int Num );
- use Types::Datetime qw( Datetime Duration );
+ use Example::Types qw( Datetime Duration );
has name => (
is => "ro",
diff --git a/lib/Type/Tiny/Manual/Libraries.pod b/lib/Type/Tiny/Manual/Libraries.pod
index f9813a9..2f168ab 100644
--- a/lib/Type/Tiny/Manual/Libraries.pod
+++ b/lib/Type/Tiny/Manual/Libraries.pod
@@ -14,7 +14,7 @@ A type library is a collection of type constraints, optionally with coercions.
The following is an example type library:
- package Types::Datetime;
+ package Example::Types;
use Type::Library
-base,
@@ -51,7 +51,7 @@ The following is an example type library:
Here's a line by line description of what's going on in the type library.
- package Types::Datetime;
+ package Example::Types;
Type libraries are packages. It is recommended that re-usable type libraries
be given a name in the C<< Types::* >> namespace. For application-specific
@@ -64,7 +64,7 @@ the C<< MyApp::Types::* >> namespace.
-declare => qw( Datetime DatetimeHash EpochHash );
The C<< -base >> part is used to establish inheritance. It makes
-C<Types::Datetime> a child class of C<Type::Library>.
+C<Example::Types> a child class of C<Type::Library>.
Declaring the types we're going to define ahead of their definition allows
us to use them as barewords later on. (Note that in code which I<uses>
@@ -145,17 +145,14 @@ Use a custom types library just like you would L<Types::Standard>:
packge MyClass;
use Moose;
use DateTime;
- use Types::Datetime qw( Datetime ); # must import the custom type
- # NOTE type spelling Datetime
- # is different than
- # class spelling DateTime
+ use Example::Types qw( Datetime ); # import the custom type
+
has 'sometime' => (
- is => 'rw',
- isa => Datetime,
- coerce => 1,
+ is => 'rw',
+ isa => Datetime,
+ coerce => 1,
);
-
=head1 ADVANCED TOPICS
=head2 Messages
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libtype-tiny-perl.git
More information about the Pkg-perl-cvs-commits
mailing list