Add Moose package
All checks were successful
release / release-plugins (push) Successful in 28s

This commit is contained in:
mschuepbach
2024-04-24 13:33:38 +02:00
parent 24101a5c1a
commit d95734d3d0
413 changed files with 47294 additions and 1 deletions

View 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;

View 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;

View 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;

View 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;

View 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;

View 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;

View 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;

View 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;

View 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;

View 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;

View 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;

View 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;

View 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;