line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package MooseX::Role::Validatable::Error; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
47206
|
use Moose; |
|
2
|
|
|
|
|
376493
|
|
|
2
|
|
|
|
|
12
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $VERSION = '0.10'; ## VERSION |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
has message => ( |
8
|
|
|
|
|
|
|
is => 'ro', |
9
|
|
|
|
|
|
|
required => 1, |
10
|
|
|
|
|
|
|
); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
has message_to_client => ( |
13
|
|
|
|
|
|
|
is => 'ro', |
14
|
|
|
|
|
|
|
required => 1, |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
has set_by => ( |
18
|
|
|
|
|
|
|
is => 'ro', |
19
|
|
|
|
|
|
|
required => 1, |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
has severity => ( |
23
|
|
|
|
|
|
|
is => 'ro', |
24
|
|
|
|
|
|
|
isa => 'Int', |
25
|
|
|
|
|
|
|
default => sub { 1 }, |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has transient => ( |
29
|
|
|
|
|
|
|
is => 'ro', |
30
|
|
|
|
|
|
|
isa => 'Bool', |
31
|
|
|
|
|
|
|
default => sub { 0 }, |
32
|
|
|
|
|
|
|
); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
has alert => ( |
35
|
|
|
|
|
|
|
is => 'ro', |
36
|
|
|
|
|
|
|
isa => 'Bool', |
37
|
|
|
|
|
|
|
default => sub { 0 }, |
38
|
|
|
|
|
|
|
); |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
has info_link => (is => 'ro'); |
41
|
|
|
|
|
|
|
has info_text => (is => 'ro'); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
sub as_html { |
44
|
2
|
|
|
2
|
1
|
5
|
my $self = shift; |
45
|
|
|
|
|
|
|
|
46
|
2
|
|
|
|
|
65
|
my $html = "<p>" . $self->message_to_client; |
47
|
2
|
50
|
|
|
|
55
|
if (my $info_link = $self->info_link) { |
48
|
2
|
|
50
|
|
|
54
|
my $info_text = $self->info_text || 'More Info...'; |
49
|
2
|
|
|
|
|
7
|
$html .= qq~<a href="$info_link" class="info_link">$info_text</a>\n~; |
50
|
|
|
|
|
|
|
} |
51
|
2
|
|
|
|
|
5
|
$html .= "</p>\n"; |
52
|
|
|
|
|
|
|
|
53
|
2
|
|
|
|
|
13
|
return $html; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
2
|
|
|
2
|
|
12637
|
no Moose; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
10
|
|
57
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
__END__ |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=encoding utf-8 |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 NAME |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
MooseX::Role::Validatable::Error - Base Error class for MooseX::Role::Validatable |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head1 SYNOPSIS |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
use MooseX::Role::Validatable; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
my $error = MooseX::Role::Validatable::Error->new({ |
73
|
|
|
|
|
|
|
message => 'Internal debug message.', # Required |
74
|
|
|
|
|
|
|
message_to_client => 'Client-facing message', # Required |
75
|
|
|
|
|
|
|
set_by => 'Source of the error', # Required; MAY default to caller(1) |
76
|
|
|
|
|
|
|
severity => 5, # For ordering, bigger is worse. Defaults to 1. |
77
|
|
|
|
|
|
|
transient => 1, # Boolean, defaults to false |
78
|
|
|
|
|
|
|
alert => 1, # Boolean, defaults to false |
79
|
|
|
|
|
|
|
info_link => 'https://example.com/', # Client-facing URI for additional info on this error. |
80
|
|
|
|
|
|
|
}); |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head1 DESCRIPTION |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Represents an error in validation |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head2 message |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
A message which might help us figure out what is wrong. |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head2 message_to_client |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
A client-friendly string describing the error. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head2 set_by |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
The source of the error. |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 severity |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
How bad is it that this happened? |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head2 transient |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Is this something likely to resolve itself with a little time? |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head2 alert |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
Should someone be alerted when this condition triggers? |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 info_link |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
A URI for further explanation of the error. |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head2 info_text |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Description of the info_link |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=head2 as_html |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=head1 AUTHOR |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
Binary.com E<lt>fayland@binary.comE<gt> |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
=head1 COPYRIGHT |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
Copyright 2014- Binary.com |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
=head1 LICENSE |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
133
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head1 SEE ALSO |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=cut |