alltests pass!
[gitmo/MooseX-Types-Data-GUID.git] / lib / MooseX / Types / Data / GUID.pm
CommitLineData
63491692 1package MooseX::Types::Data::GUID;
2
3use strict;
4use warnings;
5
6use Data::GUID;
7use MooseX::Types -declare => [qw/ GUID /];
8use Moose::Util::TypeConstraints;
9
10class_type 'Data::GUID';
11subtype GUID, as 'Data::GUID';
12
13coerce 'Data::GUID' =>
14 from Str => via { Data::GUID->from_any_string($_) };
15
16coerce GUID,
17 from Str => via { Data::GUID->from_any_string($_) };
18
191;
20
21__END__;
22
23=head1 NAME
24
25MooseX::Types::Data::GUID - L<Data::GUID> related constraints and coercions for
26Moose
27
28=head1 SYNOPSIS
29
30Export Example:
31
32 use MooseX::Types::Data::GUID qw(TimeZone);
33
34 has guid => (
35 isa => GUID,
36 is => "rw",
37 coerce => 1,
38 );
39
40 Class->new( guid => "C6A9FE9A-72FE-11DD-B3B4-B2EC1DADD46B");
41
42Namespaced Example:
43
44 use MooseX::Types::Data::GUID;
45
46 has guid => (
47 isa => 'Data::GUID',
48 is => "rw",
49 coerce => 1,
50 );
51
52 Class->new( guid => "C6A9FE9A-72FE-11DD-B3B4-B2EC1DADD46B");
53
54=head1 DESCRIPTION
55
56This module packages several L<Moose::Util::TypeConstraints> with coercions,
57designed to work with L<Data::GUID>.
58
59=head1 AUTHOR
60
61Guillermo Roditi (groditi) E<lt>groditi@cpan.orgE<gt>
62
63=head1 COPYRIGHT
64
65Copyright (c) 2008 Guillermo Roditi. This program is free software; you can
66redistribute it and/or modify it under the same terms as Perl itself.
67
68=cut