File Coverage

blib/lib/Enbld/Error.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 0 2 0.0
total 20 22 90.9


line stmt bran cond sub pod time code
1             package Enbld::Error;
2              
3 12     12   508 use strict;
  12         18  
  12         300  
4 12     12   42 use warnings;
  12         11  
  12         340  
5              
6             use overload (
7 12         81 q{""} => 'to_string',
8             fallback => 1,
9 12     12   42 );
  12         17  
10              
11             sub new {
12 14     14 0 645 my ( $class, $message ) = @_;
13              
14 14         26 chomp( $message );
15              
16 14         39 my $self = {
17             message => $message,
18             };
19              
20 14         177 return bless $self, $class;
21             }
22              
23             sub to_string {
24 13     13 0 538 my $self = shift;
25              
26 13         82 return "ERROR:$self->{message}\n";
27             }
28              
29             1;