Commit | Line | Data |
52d358e2 |
1 | package MooseX::Types::UndefinedType; |
e211870f |
2 | |
3 | =head1 NAME |
4 | |
52d358e2 |
5 | MooseX::Types::UndefinedType - Represents a not yet defined type |
e211870f |
6 | |
7 | =cut |
8 | |
9 | use warnings; |
10 | use strict; |
11 | |
12 | use overload '""' => sub { shift->name }, |
13 | fallback => 1; |
14 | |
15 | =head1 DESCRIPTION |
16 | |
17 | Whenever a type handle function (e.g. C<Int()> can't find a type |
18 | constraint under it's full name, it assumes it has not yet been defined. |
19 | It will then return an instance of this class, handling only |
20 | stringification, name and possible identification of undefined types. |
21 | |
22 | =head1 METHODS |
23 | |
24 | =head2 new |
25 | |
26 | Takes a full type name as argument and returns an instance of this |
27 | class. |
28 | |
29 | =cut |
30 | |
31 | sub new { bless { name => $_[1] }, $_[0] } |
32 | |
33 | =head2 name |
34 | |
35 | Returns the stored type name. |
36 | |
37 | =cut |
38 | |
39 | sub name { $_[0]->{name} } |
40 | |
41 | =head1 SEE ALSO |
42 | |
52d358e2 |
43 | L<MooseX::Types::Moose>, |
e211870f |
44 | L<Moose::Util::TypeConstraints>, |
45 | L<Moose::Meta::TypeConstraint> |
46 | |
47 | =head1 AUTHOR AND COPYRIGHT |
48 | |
49 | Robert 'phaylon' Sedlacek C<E<lt>rs@474.atE<gt>>, with many thanks to |
50 | the C<#moose> cabal on C<irc.perl.org>. |
51 | |
52 | =head1 LICENSE |
53 | |
54 | This program is free software; you can redistribute it and/or modify |
55 | it under the same terms as perl itself. |
56 | |
57 | =cut |
58 | |
59 | |
60 | 1; |