File Coverage

blib/lib/Moose/Exception/TypeConstraintCannotBeUsedForAParameterizableType.pm
Criterion Covered Total %
statement 7 7 100.0
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 9 9 100.0


line stmt bran cond sub pod time code
1             package Moose::Exception::TypeConstraintCannotBeUsedForAParameterizableType;
2             our $VERSION = '2.2203';
3              
4 2     2   1436 use Moose;
  2         5  
  2         11  
5             extends 'Moose::Exception';
6             with 'Moose::Exception::Role::TypeConstraint';
7              
8             has 'parent_type_name' => (
9             is => 'ro',
10             isa => 'Str',
11             required => 1,
12             documentation => "This attribute can be used for fetching type constraint(Moose::Meta::TypeConstraint):\n".
13             " my \$type_constraint = Moose::Util::TypeConstraints::find_type_constraint( \$exception->parent_type_name );\n",
14             );
15              
16             sub _build_message {
17 3     3   6 my $self = shift;
18 3         88 my $type_name = $self->type_name;
19 3         99 my $parent_type_name = $self->parent_type_name;
20 3         74 "The $type_name constraint cannot be used, because "
21             . "$parent_type_name doesn't subtype or coerce from a parameterizable type.";
22             }
23              
24             __PACKAGE__->meta->make_immutable;
25             1;