Zonemaster/Exception.pm untested

filter: Statementstmt 0.0% 0 / 16 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 22 CC 1 SCAR 6.9
CC
1
Cov
0%
string
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 package Zonemaster::Exception v1.0.0;
2  
3 use 5.14.2;
4 use Moose;
5  
6 use overload '""' => \&string;
7  
8 has 'message' => ( is => 'ro', isa => 'Str', required => 1 );
9  
10 sub string {
11 my ( $self ) = @_;
12  
13 return $self->message;
14 }
15  
16 no Moose;
17 __PACKAGE__->meta->make_immutable;
18  
19 1;
20  
21 =head1 NAME
22  
23 Zonemaster::Exception -- base class for Zonemaster exceptions
24  
25 =head1 SYNOPSIS
26  
27 die Zonemaster::Exception->new({ message => "This is an exception" });
28  
29 =head1 ATTRIBUTES
30  
31 =over
32  
33 =item message
34  
35 A string attribute holding a message for possible human consumption.
36  
37 =back
38  
39 =head1 METHODS
40  
41 =over
42  
43 =item string()
44  
45 Method that stringifies the object by returning the C<message> attribute.
46 Stringification is overloaded to this.
47  
48 =back
49  
50 =cut