File Coverage

lib/HTML/Object/ErrorEvent.pm
Criterion Covered Total %
statement 19 26 73.0
branch 0 2 0.0
condition n/a
subroutine 7 9 77.7
pod 2 2 100.0
total 28 39 71.7


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## HTML Object - ~/lib/HTML/Object/ErrorEvent.pm
3             ## Version v0.2.0
4             ## Copyright(c) 2021 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2021/12/17
7             ## Modified 2022/09/18
8             ## All rights reserved
9             ##
10             ##
11             ## This program is free software; you can redistribute it and/or modify it
12             ## under the same terms as Perl itself.
13             ##----------------------------------------------------------------------------
14             package HTML::Object::ErrorEvent;
15             BEGIN
16             {
17 28     28   208 use strict;
  28         56  
  28         900  
18 28     28   164 use warnings;
  28         72  
  28         823  
19 28     28   166 use parent qw( HTML::Object::Exception );
  28         58  
  28         180  
20 28     28   2142 use vars qw( $VERSION );
  28         62  
  28         1514  
21 28     28   577 our $VERSION = 'v0.2.0';
22             };
23              
24 28     28   139 use strict;
  28         70  
  28         525  
25 28     28   139 use warnings;
  28         73  
  28         3296  
26              
27             sub init
28             {
29 0     0 1   my $self = shift( @_ );
30 0           my $sig = shift( @_ );
31 0           $self->{_init_strict_use_sub} = 1;
32 0 0         $self->SUPER::init( @_ ) || return( $self->pass_error );
33 0           $self->{signal} = $sig;
34 0           return( $self );
35             }
36              
37 0     0 1   sub signal { return( shift->_set_get_scalar( 'signal', @_ ) ); }
38              
39             1;
40             # NOTE: POD
41             __END__
42              
43             =encoding utf-8
44              
45             =head1 NAME
46              
47             HTML::Object::ErrorEvent - HTML Object Error Event Class
48              
49             =head1 SYNOPSIS
50              
51             use HTML::Object::ErrorEvent;
52             my $event = HTML::Object::ErrorEvent->new( 'WARN' ) ||
53             die( HTML::Object::ErrorEvent->error, "\n" );
54              
55             =head1 VERSION
56              
57             v0.2.0
58              
59             =head1 DESCRIPTION
60              
61             The L<HTML::Object::ErrorEvent> object represents an error triggered and captured by a global error in the L<HTML::Object::DOM::Document> object.
62              
63             It is used by properties like L<HTML::Object::DOM::Document/onabort> or L<HTML::Object::DOM::Document/onerror>
64              
65             It inherits its methods from L<HTML::Object::Exception> and implements the additional following ones:
66              
67             =head1 INHERITANCE
68              
69             +-------------------------+ +--------------------------+
70             | HTML::Object::Exception | --> | HTML::Object::ErrorEvent |
71             +-------------------------+ +--------------------------+
72              
73             =head1 CONSTRUCTOR
74              
75             =head2 new
76              
77             This takes a signal, which is case-insensitive and is saved in uppercase, and a list of strings that compose the error message, if any (e.g. for C<WARN> or C<DIE>)
78              
79             =head1 METHODS
80              
81             =head2 signal
82              
83             The signal that triggered this event object. For example: C<DIE>, C<WARN>, C<ABRT>, C<INT>, C<TERM>
84              
85             =head1 AUTHOR
86              
87             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
88              
89             =head1 SEE ALSO
90              
91             L<HTML::Object::Exception>, L<HTML::Object::DOM::Document>
92              
93             See L<for more information|https://developer.mozilla.org/en-US/docs/Web/API/ErrorEvent>
94              
95             =head1 COPYRIGHT & LICENSE
96              
97             Copyright(c) 2021 DEGUEST Pte. Ltd.
98              
99             All rights reserved
100              
101             This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
102              
103             =cut