our $VERSION = '1.08';
our $AUTHORITY = 'cpan:STEVAN';
+use Moose::Deprecated;
use Moose::Meta::Method::Accessor;
use Moose::Meta::Method::Delegation;
use Moose::Util ();
unless ( $options->{type_constraint}->has_coercion ) {
my $type = $options->{type_constraint}->name;
- $class->throw_error("You cannot coerce an attribute ($name) unless its type ($type) has a coercion", data => $options);
+
+ Moose::Deprecated::deprecated(
+ feature => 'coerce without coercion',
+ message =>
+ "You cannot coerce an attribute ($name) unless its type ($type) has a coercion"
+ );
}
}
-#!/usr/bin/perl
-
use strict;
use warnings;
use Test::More;
-use Test::Exception;
+BEGIN {
+ eval "use Test::Output;";
+ plan skip_all => "Test::Output is required for this test" if $@;
+}
{
package Foo;
use Moose;
- ::throws_ok{ has foo => (
+ ::stderr_like{ has foo => (
is => 'ro',
isa => 'Str',
coerce => 1,
);
- } qr/\QYou cannot coerce an attribute (foo) unless its type (Str) has a coercion/,
+ }
+ qr/\QYou cannot coerce an attribute (foo) unless its type (Str) has a coercion/,
'Cannot coerce unless the type has a coercion';
}