This commit is contained in:
12
CPAN/Moose/Exception/Role/Attribute.pm
Normal file
12
CPAN/Moose/Exception/Role/Attribute.pm
Normal file
@@ -0,0 +1,12 @@
|
||||
package Moose::Exception::Role::Attribute;
|
||||
our $VERSION = '2.2207';
|
||||
|
||||
use Moose::Role;
|
||||
|
||||
has 'attribute' => (
|
||||
is => 'ro',
|
||||
isa => 'Class::MOP::Attribute',
|
||||
predicate => 'is_attribute_set'
|
||||
);
|
||||
|
||||
1;
|
||||
12
CPAN/Moose/Exception/Role/AttributeName.pm
Normal file
12
CPAN/Moose/Exception/Role/AttributeName.pm
Normal file
@@ -0,0 +1,12 @@
|
||||
package Moose::Exception::Role::AttributeName;
|
||||
our $VERSION = '2.2207';
|
||||
|
||||
use Moose::Role;
|
||||
|
||||
has 'attribute_name' => (
|
||||
is => 'ro',
|
||||
isa => 'Str',
|
||||
required => 1
|
||||
);
|
||||
|
||||
1;
|
||||
14
CPAN/Moose/Exception/Role/Class.pm
Normal file
14
CPAN/Moose/Exception/Role/Class.pm
Normal file
@@ -0,0 +1,14 @@
|
||||
package Moose::Exception::Role::Class;
|
||||
our $VERSION = '2.2207';
|
||||
|
||||
use Moose::Role;
|
||||
|
||||
has 'class_name' => (
|
||||
is => 'ro',
|
||||
isa => 'Str',
|
||||
required => 1,
|
||||
documentation => "This attribute can be used for fetching metaclass instance:\n".
|
||||
" my \$metaclass_instance = Moose::Util::find_meta( \$exception->class_name );\n",
|
||||
);
|
||||
|
||||
1;
|
||||
49
CPAN/Moose/Exception/Role/EitherAttributeOrAttributeName.pm
Normal file
49
CPAN/Moose/Exception/Role/EitherAttributeOrAttributeName.pm
Normal file
@@ -0,0 +1,49 @@
|
||||
package Moose::Exception::Role::EitherAttributeOrAttributeName;
|
||||
our $VERSION = '2.2207';
|
||||
|
||||
use Moose::Util 'throw_exception';
|
||||
use Moose::Role;
|
||||
|
||||
has 'attribute_name' => (
|
||||
is => 'ro',
|
||||
isa => 'Str',
|
||||
lazy_build => 1
|
||||
);
|
||||
|
||||
has 'attribute' => (
|
||||
is => 'ro',
|
||||
isa => 'Class::MOP::Attribute',
|
||||
predicate => 'has_attribute'
|
||||
);
|
||||
|
||||
has 'params' => (
|
||||
is => 'ro',
|
||||
isa => 'HashRef',
|
||||
predicate => 'has_params',
|
||||
);
|
||||
|
||||
sub _build_attribute_name {
|
||||
my $self = shift;
|
||||
|
||||
if( !$self->has_attribute )
|
||||
{
|
||||
throw_exception("NeitherAttributeNorAttributeNameIsGiven");
|
||||
}
|
||||
|
||||
return $self->attribute->name;
|
||||
}
|
||||
|
||||
after "BUILD" => sub {
|
||||
my $self = $_[0];
|
||||
|
||||
if( $self->has_attribute_name &&
|
||||
$self->has_attribute &&
|
||||
( $self->attribute->name ne $self->attribute_name ) )
|
||||
{
|
||||
throw_exception( AttributeNamesDoNotMatch => attribute_name => $self->attribute_name,
|
||||
attribute => $self->attribute
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
1;
|
||||
12
CPAN/Moose/Exception/Role/Instance.pm
Normal file
12
CPAN/Moose/Exception/Role/Instance.pm
Normal file
@@ -0,0 +1,12 @@
|
||||
package Moose::Exception::Role::Instance;
|
||||
our $VERSION = '2.2207';
|
||||
|
||||
use Moose::Role;
|
||||
|
||||
has 'instance' => (
|
||||
is => 'ro',
|
||||
isa => 'Object',
|
||||
required => 1,
|
||||
);
|
||||
|
||||
1;
|
||||
12
CPAN/Moose/Exception/Role/InstanceClass.pm
Normal file
12
CPAN/Moose/Exception/Role/InstanceClass.pm
Normal file
@@ -0,0 +1,12 @@
|
||||
package Moose::Exception::Role::InstanceClass;
|
||||
our $VERSION = '2.2207';
|
||||
|
||||
use Moose::Role;
|
||||
|
||||
has 'instance_class' => (
|
||||
is => 'ro',
|
||||
isa => 'Str',
|
||||
required => 1,
|
||||
);
|
||||
|
||||
1;
|
||||
13
CPAN/Moose/Exception/Role/InvalidAttributeOptions.pm
Normal file
13
CPAN/Moose/Exception/Role/InvalidAttributeOptions.pm
Normal file
@@ -0,0 +1,13 @@
|
||||
package Moose::Exception::Role::InvalidAttributeOptions;
|
||||
our $VERSION = '2.2207';
|
||||
|
||||
use Moose::Role;
|
||||
with 'Moose::Exception::Role::ParamsHash';
|
||||
|
||||
has 'attribute_name' => (
|
||||
is => 'ro',
|
||||
isa => 'Str',
|
||||
required => 1,
|
||||
);
|
||||
|
||||
1;
|
||||
12
CPAN/Moose/Exception/Role/Method.pm
Normal file
12
CPAN/Moose/Exception/Role/Method.pm
Normal file
@@ -0,0 +1,12 @@
|
||||
package Moose::Exception::Role::Method;
|
||||
our $VERSION = '2.2207';
|
||||
|
||||
use Moose::Role;
|
||||
|
||||
has 'method' => (
|
||||
is => 'ro',
|
||||
isa => 'Moose::Meta::Method',
|
||||
required => 1,
|
||||
);
|
||||
|
||||
1;
|
||||
12
CPAN/Moose/Exception/Role/ParamsHash.pm
Normal file
12
CPAN/Moose/Exception/Role/ParamsHash.pm
Normal file
@@ -0,0 +1,12 @@
|
||||
package Moose::Exception::Role::ParamsHash;
|
||||
our $VERSION = '2.2207';
|
||||
|
||||
use Moose::Role;
|
||||
|
||||
has 'params' => (
|
||||
is => 'ro',
|
||||
isa => 'HashRef',
|
||||
required => 1,
|
||||
);
|
||||
|
||||
1;
|
||||
16
CPAN/Moose/Exception/Role/Role.pm
Normal file
16
CPAN/Moose/Exception/Role/Role.pm
Normal file
@@ -0,0 +1,16 @@
|
||||
package Moose::Exception::Role::Role;
|
||||
our $VERSION = '2.2207';
|
||||
|
||||
# use Moose::Util 'throw_exception';
|
||||
use Moose::Role;
|
||||
|
||||
has 'role_name' => (
|
||||
is => 'ro',
|
||||
isa => 'Str',
|
||||
required => 1,
|
||||
documentation => "This attribute can be used for fetching the class's metaclass instance:\n".
|
||||
" my \$metaclass_instance = Moose::Util::find_meta( \$exception->role_name );\n",
|
||||
|
||||
);
|
||||
|
||||
1;
|
||||
13
CPAN/Moose/Exception/Role/RoleForCreate.pm
Normal file
13
CPAN/Moose/Exception/Role/RoleForCreate.pm
Normal file
@@ -0,0 +1,13 @@
|
||||
package Moose::Exception::Role::RoleForCreate;
|
||||
our $VERSION = '2.2207';
|
||||
|
||||
use Moose::Role;
|
||||
with 'Moose::Exception::Role::ParamsHash';
|
||||
|
||||
has 'attribute_class' => (
|
||||
is => 'ro',
|
||||
isa => 'Str',
|
||||
required => 1,
|
||||
);
|
||||
|
||||
1;
|
||||
13
CPAN/Moose/Exception/Role/RoleForCreateMOPClass.pm
Normal file
13
CPAN/Moose/Exception/Role/RoleForCreateMOPClass.pm
Normal file
@@ -0,0 +1,13 @@
|
||||
package Moose::Exception::Role::RoleForCreateMOPClass;
|
||||
our $VERSION = '2.2207';
|
||||
|
||||
use Moose::Role;
|
||||
with 'Moose::Exception::Role::ParamsHash';
|
||||
|
||||
has 'class' => (
|
||||
is => 'ro',
|
||||
isa => 'Str',
|
||||
required => 1,
|
||||
);
|
||||
|
||||
1;
|
||||
14
CPAN/Moose/Exception/Role/TypeConstraint.pm
Normal file
14
CPAN/Moose/Exception/Role/TypeConstraint.pm
Normal file
@@ -0,0 +1,14 @@
|
||||
package Moose::Exception::Role::TypeConstraint;
|
||||
our $VERSION = '2.2207';
|
||||
|
||||
use Moose::Role;
|
||||
|
||||
has 'type_name' => (
|
||||
is => 'ro',
|
||||
isa => 'Str',
|
||||
required => 1,
|
||||
documentation => "This attribute can be used for fetching type constraint(Moose::Meta::TypeConstraint):\n".
|
||||
" my \$type_constraint = Moose::Util::TypeConstraints::find_type_constraint( \$exception->type_name );\n",
|
||||
);
|
||||
|
||||
1;
|
||||
Reference in New Issue
Block a user