1 package MooseX::Types::TypeDecorator;
6 use Moose::Util::TypeConstraints;
9 shift->type_constraint->name;
12 my @names = grep {$_} map {"$_"} @_;
13 ## Don't know why I can't use the array version of this...
14 my $names = join('|', @names);
15 Moose::Util::TypeConstraints::create_type_constraint_union($names);
21 MooseX::Types::TypeDecorator - More flexible access to a Type Constraint
25 This is a decorator object that contains an underlying type constraint. We use
26 this to control access to the type constraint and to add some features.
30 This class defines the following methods.
34 Old school instantiation
39 my ($class, %args) = @_;
40 return bless \%args, $class;
43 =head type_constraint ($type_constraint)
45 Set/Get the type_constraint
51 if(my $tc = shift @_) {
52 $self->{type_constraint} = $tc;
54 return $self->{type_constraint};
59 We might need it later
69 Delegate to the decorator targe
75 my ($method) = (our $AUTOLOAD =~ /([^:]+)$/);
76 return shift->type_constraint->$method(@_);
79 =head1 AUTHOR AND COPYRIGHT
81 John Napiorkowski (jnapiorkowski) <jjnapiork@cpan.org>
85 This program is free software; you can redistribute it and/or modify
86 it under the same terms as perl itself.