use MooseX::Types::Util qw( filter_tags );
use MooseX::Types::UndefinedType;
use Sub::Install qw( install_sub );
+use Carp qw( croak );
use Moose;
use namespace::clean -except => [qw( meta )];
You will have to define coercions for your types or your library won't
export a L</to_$type> coercion helper for it.
+Note that you currently cannot define types containint C<::>, since
+exporting would be a problem.
+
=head1 LIBRARY USAGE
You can import the L<"type helpers"|/"TYPE HANDLER FUNCTIONS"> of a
my ($tags, $declare) = filter_tags @orig_declare;
for my $type (@$declare) {
+
+ croak "Cannot create a type containing '::' ($type) at the moment"
+ if $type =~ /::/;
+
$callee->add_type($type);
$callee->export_type_into(
$callee, $type,
[ 'IntArrayRef', 12, [12], {}, [17, 23], {} ],
);
-plan tests => (@tests * 8) + 1;
+plan tests => (@tests * 8) + 3;
# new array ref so we can safely shift from it
for my $data (map { [@$_] } @tests) {
# coercion not available
ok ! __PACKAGE__->can('to_TwentyThree'), "type without coercion doesn't have to_* helper";
+
+eval { require TestNamespaceSep };
+ok $@, q(trying to declare a type with '::' in it croaks);
+like $@, qr/Foo::Bar/, q(error message contains type name);