Validatable/Error.pm

filter: Statementstmt 100% 30 / 30 Branchbran 50.0% 1 / 2 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 7 / 7 Podpod 100% 1 / 1 totaltotal 93.0% 40 / 43 CC 3 SCAR 5.2
CC
3
Cov
94%
as_html
3.1
BEGIN
1.0
__ANON__
1.0
CRAP 1.7
« Validatable.pm ↑ Summary
1 package MooseX::Role::Validatable::Error;
2  
3 4 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 4 our $VERSION = '0.12'; ## VERSION
6  
7 4 has message => (
8 is => 'ro',
9 required => 1,
10 );
11  
12 4 has message_to_client => (
13 is => 'ro',
14 required => 1,
15 );
16  
17 4 has details => (
18 is => 'ro',
19 isa => 'HashRef',
20 required => 0,
21 );
22  
23 4 has set_by => (
24 is => 'ro',
25 required => 1,
26 );
27  
28 has severity => (
29 is => 'ro',
30 isa => 'Int',
31 3 ▶ default => sub { 1 },
Subroutine __ANON__: called CC=1 SCAR=0.0
32 4 );
33  
34 has transient => (
35 is => 'ro',
36 isa => 'Bool',
37 3 ▶ default => sub { 0 },
Subroutine __ANON__: called CC=1 SCAR=0.0
38 4 );
39  
40 has alert => (
41 is => 'ro',
42 isa => 'Bool',
43 3 ▶ default => sub { 0 },
Subroutine __ANON__: called CC=1 SCAR=0.0
44 4 );
45  
46 4 has info_link => (is => 'ro');
47 4 has info_text => (is => 'ro');
48  
49 has code => (
50 is => 'ro',
51 isa => 'Str',
52 4 ▶ default => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
53 4 return 'General';
54 },
55 4 );
56  
57 2 ▶sub as_html {
Subroutine as_html: called CC=3 SCAR=11.2
Pod documented
58 2 my $self = shift;
59  
60 2 my $html = "<p>" . $self->message_to_client;
61 2 ▶ if (my $info_link = $self->info_link) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $info_link = $self->info_link) 2 0 2
62 2 ▶ my $info_text = $self->info_text || 'More Info...';
Condition50%1/2
$self->info_text || 'More Info...'
l!l
02
MC/DC0%0/1
$self->info_text || 'More Info...'
$self->info_text
Truth table50%1/2
A
A= $self->info_text
Aresult
11
00
63 2 $html .= qq~<a href="$info_link" class="info_link">$info_text</a>\n~;
64 }
65 2 $html .= "</p>\n";
66  
67 2 return $html;
68 }
69  
70 4 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
71 4 __PACKAGE__->meta->make_immutable;
72  
73 4 1;
74 __END__
« Validatable.pm ↑ Summary