2 package MooseX::Getopt::OptionTypeMap;
5 use Moose::Util::TypeConstraints 'find_type_constraint';
8 our $AUTHORITY = 'cpan:STEVAN';
10 my %option_type_map = (
19 sub has_option_type { exists $option_type_map{$_[1]} }
20 sub get_option_type { $option_type_map{$_[1]} }
21 sub add_option_type_to_map {
22 my (undef, $type_name, $option_string) = @_;
23 (defined $type_name && defined $option_string)
24 || confess "You must supply both a type name and an option string";
25 (find_type_constraint($type_name))
26 || confess "The type constraint '$type_name' does not exist";
27 $option_type_map{$type_name} = $option_string;
30 no Moose; no Moose::Util::TypeConstraints; 1;
39 MooseX::Getopt::OptionTypeMap - Storage for the option to type mappings
43 See the I<Custom Type Constraints> section in the L<MooseX::Getopt> docs
44 for more info about how to use this module.
48 These are all class methods and should be called as such.
52 =item B<has_option_type ($type_name)>
54 =item B<get_option_type ($type_name)>
56 =item B<add_option_type_to_map ($type_name, $option_spec)>
62 All complex software has bugs lurking in it, and this module is no
63 exception. If you find a bug please either email me, or add the bug
68 Stevan Little E<lt>stevan@iinteractive.comE<gt>
70 =head1 COPYRIGHT AND LICENSE
72 Copyright 2007 by Infinity Interactive, Inc.
74 L<http://www.iinteractive.com>
76 This library is free software; you can redistribute it and/or modify
77 it under the same terms as Perl itself.