« blib/lib/Moose/Exception/TriggerMustBeACodeRef.pm
↑ Summary
blib/lib/Moose/Exception/TypeConstraintIsAlreadyCreated.pm »
| 1 | package Moose::Exception::TypeConstraintCannotBeUsedForAParameterizableType; | ||
| 2 | 2 | our $VERSION = '2.4001'; | |
| 3 | |||
| 4 | 2 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 2 | extends 'Moose::Exception'; | |
| 6 | 2 | with 'Moose::Exception::Role::TypeConstraint'; | |
| 7 | |||
| 8 | 2 | 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 | 3 | ▶ | sub _build_message { |
|
Subroutine
_build_message: called CC=1 SCAR=0.0
| |||
| 17 | 3 | my $self = shift; | |
| 18 | 3 | my $type_name = $self->type_name; | |
| 19 | 3 | my $parent_type_name = $self->parent_type_name; | |
| 20 | 3 | "The $type_name constraint cannot be used, because " | |
| 21 | . "$parent_type_name doesn't subtype or coerce from a parameterizable type."; | ||
| 22 | } | ||
| 23 | |||
| 24 | 2 | __PACKAGE__->meta->make_immutable; | |
| 25 | 2 | 1; | |