allow inlining if the type has been subsequently defined
[gitmo/MooseX-Types.git] / lib / MooseX / Types / UndefinedType.pm
index 4045c19..97e4031 100644 (file)
@@ -1,11 +1,5 @@
 package MooseX::Types::UndefinedType;
 
-=head1 NAME
-
-MooseX::Types::UndefinedType - Represents a not yet defined type
-
-=cut
-
 use warnings;
 use strict;
 
@@ -66,6 +60,22 @@ sub __autovivify {
     }
 }
 
+=head2 can_be_inlined
+
+Make sure that if a type hasn't been defined yet when Moose wants to inline it,
+we don't allow inlining.
+
+=cut
+
+sub can_be_inlined {
+    my $self = shift;
+    if(my $type_constraint = $self->__autovivify) {
+        return $type_constraint->can_be_inlined;
+    } else {
+        return;
+    }
+}
+
 =head2 AUTOLOAD
 
 Try to autovivify and delegate
@@ -101,13 +111,6 @@ L<Moose::Util::TypeConstraints>,
 L<Moose::Meta::TypeConstraint>,
 L<Carp::Clan>
 
-=head1 AUTHOR AND COPYRIGHT
-
-Robert 'phaylon' Sedlacek C<E<lt>rs@474.atE<gt>>, with many thanks to
-the C<#moose> cabal on C<irc.perl.org>.
-
-Additional features by John Napiorkowski (jnapiorkowski) <jjnapiork@cpan.org>
-
 =head1 LICENSE
 
 This program is free software; you can redistribute it and/or modify