« blib/lib/Moose/Exception/TypeConstraintCannotBeUsedForAParameterizableType.pm
↑ Summary
blib/lib/Moose/Exception/TypeParameterMustBeMooseMetaType.pm »
| 1 | package Moose::Exception::TypeConstraintIsAlreadyCreated; | ||
| 2 | 3 | our $VERSION = '2.4001'; | |
| 3 | |||
| 4 | 3 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 3 | extends 'Moose::Exception'; | |
| 6 | 3 | with 'Moose::Exception::Role::TypeConstraint'; | |
| 7 | |||
| 8 | 3 | ▶ | use Moose::Util::TypeConstraints 'find_type_constraint'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 3 | has 'package_defined_in' => ( | |
| 11 | is => 'ro', | ||
| 12 | isa => 'Str', | ||
| 13 | required => 1, | ||
| 14 | ); | ||
| 15 | |||
| 16 | 6 | ▶ | sub _build_message { |
|
Subroutine
_build_message: called CC=1 SCAR=0.0
| |||
| 17 | 6 | my $self = shift; | |
| 18 | 6 | my $type_name = $self->type_name; | |
| 19 | 6 | my $type = find_type_constraint( $type_name ); | |
| 20 | 6 | my $type_package_defined_in = $type->_package_defined_in; | |
| 21 | 6 | my $package_defined_in = $self->package_defined_in; | |
| 22 | 6 | return "The type constraint '$type_name' has already been created in $type_package_defined_in and cannot be created again in $package_defined_in"; | |
| 23 | } | ||
| 24 | |||
| 25 | 3 | __PACKAGE__->meta->make_immutable; | |
| 26 | 3 | 1; | |