3 MooseX::Types::CheckedUtilExports - Wrap L<Moose::Util::TypeConstraints> to be
4 safer for L<MooseX::Types>
8 package MooseX::Types::CheckedUtilExports;
12 use Moose::Util::TypeConstraints ();
17 use namespace::clean -except => 'meta';
20 q{WARNING: String found where Type expected (did you use a => instead of a , ?)};
22 my @exports = qw/type subtype maybe_type duck_type enum coerce from as/;
31 Which should be written as:
36 When using L<MooseX::Types>. Exported by that module.
38 Exports checked versions of the following subs:
40 C<type> C<subtype> C<maybe_type> C<duck_type> C<enum> C<coerce> C<from> C<as>
42 While C<class_type> and C<role_type> will also register the type in the library.
44 From L<Moose::Util::TypeConstraints>. See that module for syntax.
48 Moose::Exporter->setup_import_methods(
49 with_caller => [ @exports, 'class_type', 'role_type' ]
52 for my $export (@exports) {
58 local $Carp::CarpLevel = $Carp::CarpLevel + 1;
62 $_[0] =~ /\b::\b/ || # qualified type
63 $caller->get_registered_class_type($_[0]) ||
64 $caller->get_registered_role_type($_[0]);
66 goto &{"Moose::Util::TypeConstraints::$export"};
73 $caller->register_class_type(
74 Moose::Util::TypeConstraints::class_type(@_)
79 my ($caller, $name, $opts) = @_;
81 $caller->register_role_type(
82 Moose::Util::TypeConstraints::role_type($name, $opts)
92 This program is free software; you can redistribute it and/or modify
93 it under the same terms as perl itself.