File: Exception.pm

package info (click to toggle)
libzonemaster-perl 8.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 72,256 kB
  • sloc: perl: 16,941; makefile: 16
file content (51 lines) | stat: -rw-r--r-- 798 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package Zonemaster::Engine::Exception;

use v5.16.0;
use warnings;

use version; our $VERSION = version->declare("v1.0.3");

use Class::Accessor "antlers";

use overload '""' => \&string;

has 'message' => ( is => 'ro', isa => 'Str', required => 1 );

sub string {
    my ( $self ) = @_;

    return $self->message;
}

1;

=head1 NAME

Zonemaster::Engine::Exception -- base class for Zonemaster::Engine exceptions

=head1 SYNOPSIS

   die Zonemaster::Engine::Exception->new({ message => "This is an exception" });

=head1 ATTRIBUTES

=over

=item message

A string attribute holding a message for possible human consumption.

=back

=head1 METHODS

=over

=item string()

Method that stringifies the object by returning the C<message> attribute.
Stringification is overloaded to this.

=back

=cut