line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Moose::Exception::AttributeIsRequired; |
2
|
|
|
|
|
|
|
our $VERSION = '2.2205'; |
3
|
|
|
|
|
|
|
|
4
|
14
|
|
|
14
|
|
9631
|
use Moose; |
|
14
|
|
|
|
|
41
|
|
|
14
|
|
|
|
|
121
|
|
5
|
|
|
|
|
|
|
extends 'Moose::Exception'; |
6
|
|
|
|
|
|
|
with 'Moose::Exception::Role::Class'; |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has 'attribute_name' => ( |
9
|
|
|
|
|
|
|
is => 'ro', |
10
|
|
|
|
|
|
|
isa => 'Str', |
11
|
|
|
|
|
|
|
required => 1, |
12
|
|
|
|
|
|
|
documentation => "This attribute can be used for fetching attribute instance:\n". |
13
|
|
|
|
|
|
|
" my \$class = Moose::Util::find_meta( \$exception->class_name );\n". |
14
|
|
|
|
|
|
|
" my \$attribute = \$class->get_attribute( \$exception->attribute_name );\n", |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has 'attribute_init_arg' => ( |
18
|
|
|
|
|
|
|
is => 'ro', |
19
|
|
|
|
|
|
|
isa => 'Str', |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has 'params' => ( |
23
|
|
|
|
|
|
|
is => 'ro', |
24
|
|
|
|
|
|
|
isa => 'HashRef', |
25
|
|
|
|
|
|
|
predicate => 'has_params', |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub _build_message { |
29
|
60
|
|
|
60
|
|
127
|
my $self = shift; |
30
|
|
|
|
|
|
|
|
31
|
60
|
|
|
|
|
1984
|
my $name = $self->attribute_name; |
32
|
60
|
|
|
|
|
189
|
my $msg = "Attribute ($name)"; |
33
|
|
|
|
|
|
|
|
34
|
60
|
|
|
|
|
1995
|
my $init_arg = $self->attribute_init_arg; |
35
|
60
|
100
|
66
|
|
|
347
|
if ( defined $init_arg && $name ne $init_arg ) { |
36
|
1
|
|
|
|
|
8
|
$msg .= ", passed as ($init_arg),"; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
60
|
|
|
|
|
181
|
$msg .= ' is required'; |
40
|
|
|
|
|
|
|
|
41
|
60
|
|
|
|
|
1459
|
return $msg; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
45
|
|
|
|
|
|
|
1; |