Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/lib64/perl5/vendor_perl/Moose/Exception/Role/ |
Upload File : |
package Moose::Exception::Role::EitherAttributeOrAttributeName; our $VERSION = '2.2201'; 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;