| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Moose::Exception::Role::EitherAttributeOrAttributeName; |
|
2
|
|
|
|
|
|
|
our $VERSION = '2.2205'; |
|
3
|
|
|
|
|
|
|
|
|
4
|
12
|
|
|
12
|
|
8416
|
use Moose::Util 'throw_exception'; |
|
|
12
|
|
|
|
|
36
|
|
|
|
12
|
|
|
|
|
120
|
|
|
5
|
12
|
|
|
12
|
|
4719
|
use Moose::Role; |
|
|
12
|
|
|
|
|
44
|
|
|
|
12
|
|
|
|
|
86
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has 'attribute_name' => ( |
|
8
|
|
|
|
|
|
|
is => 'ro', |
|
9
|
|
|
|
|
|
|
isa => 'Str', |
|
10
|
|
|
|
|
|
|
lazy_build => 1 |
|
11
|
|
|
|
|
|
|
); |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
has 'attribute' => ( |
|
14
|
|
|
|
|
|
|
is => 'ro', |
|
15
|
|
|
|
|
|
|
isa => 'Class::MOP::Attribute', |
|
16
|
|
|
|
|
|
|
predicate => 'has_attribute' |
|
17
|
|
|
|
|
|
|
); |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has 'params' => ( |
|
20
|
|
|
|
|
|
|
is => 'ro', |
|
21
|
|
|
|
|
|
|
isa => 'HashRef', |
|
22
|
|
|
|
|
|
|
predicate => 'has_params', |
|
23
|
|
|
|
|
|
|
); |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _build_attribute_name { |
|
26
|
3
|
|
|
3
|
|
9
|
my $self = shift; |
|
27
|
|
|
|
|
|
|
|
|
28
|
3
|
100
|
|
|
|
139
|
if( !$self->has_attribute ) |
|
29
|
|
|
|
|
|
|
{ |
|
30
|
1
|
|
|
|
|
5
|
throw_exception("NeitherAttributeNorAttributeNameIsGiven"); |
|
31
|
|
|
|
|
|
|
} |
|
32
|
|
|
|
|
|
|
|
|
33
|
2
|
|
|
|
|
83
|
return $self->attribute->name; |
|
34
|
|
|
|
|
|
|
} |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
after "BUILD" => sub { |
|
37
|
|
|
|
|
|
|
my $self = $_[0]; |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
if( $self->has_attribute_name && |
|
40
|
|
|
|
|
|
|
$self->has_attribute && |
|
41
|
|
|
|
|
|
|
( $self->attribute->name ne $self->attribute_name ) ) |
|
42
|
|
|
|
|
|
|
{ |
|
43
|
|
|
|
|
|
|
throw_exception( AttributeNamesDoNotMatch => attribute_name => $self->attribute_name, |
|
44
|
|
|
|
|
|
|
attribute => $self->attribute |
|
45
|
|
|
|
|
|
|
); |
|
46
|
|
|
|
|
|
|
} |
|
47
|
|
|
|
|
|
|
}; |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
1; |