=cut
sub make_class {
- my ($is, $attr, $class) = @_;
+ my ($is, $attr, $class) = @_;
- eval "package $class; use Moose; has 'foo' => ( is => '$is', $attr => '_foo' );";
+ eval "package $class; use Moose; has 'foo' => ( is => '$is', $attr => '_foo' );";
- return $@ ? die $@ : $class;
+ return $@ ? die $@ : $class;
}
my $obj;
? $_[0]
: $_[0]->meta->prototype_instance;
my (undef, %params) = @_;
- my $self = $prototype->meta->clone_object($prototype, %params);
- $self->BUILDALL(\%params);
- return $self;
+ my $self = $prototype->meta->clone_object($prototype, %params);
+ $self->BUILDALL(\%params);
+ return $self;
}
}
use Test::Exception;
BEGIN {
- use_ok('Moose::Util::TypeConstraints');
+ use_ok('Moose::Util::TypeConstraints');
}
lives_ok {
- subtype 'ParentConstraint' => as 'Str' => where {0};
+ subtype 'ParentConstraint' => as 'Str' => where {0};
} 'specified parent type constraint';
my $tc;
lives_ok {
- $tc = subtype 'ChildConstraint' => as 'ParentConstraint' => where {1};
+ $tc = subtype 'ChildConstraint' => as 'ParentConstraint' => where {1};
} 'specified child type constraint';
{
- my $errmsg = $tc->validate();
+ my $errmsg = $tc->validate();
- TODO: {
- local $TODO = 'Not yet supported';
- ok($errmsg !~ /Validation failed for 'ChildConstraint'/, 'exception references failing parent constraint');
- };
+ TODO: {
+ local $TODO = 'Not yet supported';
+ ok($errmsg !~ /Validation failed for 'ChildConstraint'/, 'exception references failing parent constraint');
+ };
}