created the decorator and got it hooked up, made sure all the old tests pass
[gitmo/MooseX-Types.git] / lib / MooseX / Types / TypeDecorator.pm
CommitLineData
4c2125a4 1package MooseX::Types::TypeDecorator;
2
3use Moose;
4use Moose::Util::TypeConstraints;
5use Moose::Meta::TypeConstraint ();
6
7use overload(
8 '""' => sub {
9 shift->type_constraint->name;
10 },
11);
12
13=head1 NAME
14
15MooseX::Types::TypeDecorator - More flexible access to a Type Constraint
16
17=head1 DESCRIPTION
18
19This is a decorator object that contains an underlying type constraint. We use
20this to control access to the type constraint and to add some features.
21
22=head1 TYPES
23
24The following types are defined in this class.
25
26=head2 Moose::Meta::TypeConstraint
27
28Used to make sure we can properly validate incoming type constraints.
29
30=cut
31
32class_type 'Moose::Meta::TypeConstraint';
33
34=head2 MooseX::Types::UndefinedType
35
36Used since sometimes our constraint is an unknown type.
37
38=cut
39
40class_type 'MooseX::Types::UndefinedType';
41
42=head1 ATTRIBUTES
43
44This class defines the following attributes
45
46=head2 type_constraint
47
48This is the type constraint that we are delegating
49
50=cut
51
52has 'type_constraint' => (
53 is=>'ro',
54 isa=>'Moose::Meta::TypeConstraint|MooseX::Types::UndefinedType',
55 handles=>[
56 Moose::Meta::TypeConstraint->meta->compute_all_applicable_methods,
57 "_compiled_type_constraint",
58 ],
59);
60
61=head1 METHODS
62
63This class defines the following methods.
64
65=head1 AUTHOR AND COPYRIGHT
66
67John Napiorkowski (jnapiorkowski) <jjnapiork@cpan.org>
68
69=head1 LICENSE
70
71This program is free software; you can redistribute it and/or modify
72it under the same terms as perl itself.
73
74=cut
75
761;