[libtype-tiny-perl] 03/14: add example of using the custom types library
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 5974614f2ad274d9092b11ddf592216ff4ce5dc9
Author: Peter Karman <karpet at peknet.com>
Date: Fri Apr 25 10:34:36 2014 -0500
add example of using the custom types library
---
lib/Type/Tiny/Manual/Libraries.pod | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/lib/Type/Tiny/Manual/Libraries.pod b/lib/Type/Tiny/Manual/Libraries.pod
index 3d90539..f9813a9 100644
--- a/lib/Type/Tiny/Manual/Libraries.pod
+++ b/lib/Type/Tiny/Manual/Libraries.pod
@@ -138,6 +138,24 @@ These are simply coderefs that will be fired when you want a Datetime,
but are given something else. For more information on coercions, see
L<Type::Tiny::Manual::Coercions>.
+=head1 USING YOUR LIBRARY
+
+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
+ has 'sometime' => (
+ 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