fix for prototype undecl issue when type constraint utils loaded before consumers...
[gitmo/Moose.git] / t / 054_util_type_coercion.t
index 6a1669c..c483323 100644 (file)
@@ -12,8 +12,6 @@ BEGIN {
 
 {
     package HTTPHeader;
-    use strict;
-    use warnings;
     use Moose;
     
     has 'array' => (is => 'ro');
@@ -29,6 +27,21 @@ coerce Header
         => via { HTTPHeader->new(array => $_[0]) }
     => from HashRef 
         => via { HTTPHeader->new(hash => $_[0]) };
+
+
+{
+       package Math::BigFloat;
+       sub new { bless { }, shift }; # not a moose class ;-)
+}
+
+subtype "Math::BigFloat"
+       => as "Math::BigFloat"
+       => where { 1 };
+
+coerce "Math::BigFloat"
+       => from Num
+               => via { Math::BigFloat->new( $_ ) };
+
         
 Moose::Util::TypeConstraints->export_type_contstraints_as_functions();