{
package HTTPHeader;
- use strict;
- use warnings;
use Moose;
has 'array' => (is => 'ro');
=> 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();
+Moose::Util::TypeConstraints->export_type_contstraints_as_functions();
my $header = HTTPHeader->new();
isa_ok($header, 'HTTPHeader');
ok(!Header([]), '... this did not pass the type test');
ok(!Header({}), '... this did not pass the type test');
-my $coercion = Moose::Util::TypeConstraints::find_type_constraint('Header')->coercion;
+my $coercion = find_type_constraint('Header')->coercion;
isa_ok($coercion, 'Moose::Meta::TypeCoercion');
{