| 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 | use strict; | ||
| 18 | use warnings; | ||
| 19 | warnings::register_categories( 'HTML::Object' ); | ||
| 20 | use parent qw( HTML::Object::Exception ); | ||
| 21 | use vars qw( $VERSION ); | ||
| 22 | our $VERSION = 'v0.2.0'; | ||
| 23 | }; | ||
| 24 | |||
| 25 | use strict; | ||
| 26 | use warnings; | ||
| 27 | |||
| 28 | sub init | ||
| 29 | { | ||
| 30 | my $self = shift( @_ ); | ||
| 31 | my $sig = shift( @_ ); | ||
| 32 | $self->{_init_strict_use_sub} = 1; | ||
| 33 | $self->SUPER::init( @_ ) || return( $self->pass_error ); | ||
| 34 | $self->{signal} = $sig; | ||
| 35 | return( $self ); | ||
| 36 | } | ||
| 37 | |||
| 38 | sub signal { return( shift->_set_get_scalar( 'signal', @_ ) ); } | ||
| 39 | |||
| 40 | 1; | ||
| 41 | # NOTE: POD | ||
| 42 | __END__ | ||
| 43 | |||
| 44 | =encoding utf-8 | ||
| 45 | |||
| 46 | =head1 NAME | ||
| 47 | |||
| 48 | HTML::Object::ErrorEvent - HTML Object Error Event Class | ||
| 49 | |||
| 50 | =head1 SYNOPSIS | ||
| 51 | |||
| 52 | use HTML::Object::ErrorEvent; | ||
| 53 | my $event = HTML::Object::ErrorEvent->new( 'WARN' ) || | ||
| 54 | die( HTML::Object::ErrorEvent->error, "\n" ); | ||
| 55 | |||
| 56 | =head1 VERSION | ||
| 57 | |||
| 58 | v0.2.0 | ||
| 59 | |||
| 60 | =head1 DESCRIPTION | ||
| 61 | |||
| 62 | The L<HTML::Object::ErrorEvent> object represents an error triggered and captured by a global error in the L<HTML::Object::DOM::Document> object. | ||
| 63 | |||
| 64 | It is used by properties like L<HTML::Object::DOM::Document/onabort> or L<HTML::Object::DOM::Document/onerror> | ||
| 65 | |||
| 66 | It inherits its methods from L<HTML::Object::Exception> and implements the additional following ones: | ||
| 67 | |||
| 68 | =head1 INHERITANCE | ||
| 69 | |||
| 70 | +-------------------------+ +--------------------------+ | ||
| 71 | | HTML::Object::Exception | --> | HTML::Object::ErrorEvent | | ||
| 72 | +-------------------------+ +--------------------------+ | ||
| 73 | |||
| 74 | =head1 CONSTRUCTOR | ||
| 75 | |||
| 76 | =head2 new | ||
| 77 | |||
| 78 | 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>) | ||
| 79 | |||
| 80 | =head1 METHODS | ||
| 81 | |||
| 82 | =head2 signal | ||
| 83 | |||
| 84 | The signal that triggered this event object. For example: C<DIE>, C<WARN>, C<ABRT>, C<INT>, C<TERM> | ||
| 85 | |||
| 86 | =head1 AUTHOR | ||
| 87 | |||
| 88 | Jacques Deguest E<lt>F<jack@deguest.jp>E<gt> | ||
| 89 | |||
| 90 | =head1 SEE ALSO | ||
| 91 | |||
| 92 | L<HTML::Object::Exception>, L<HTML::Object::DOM::Document> | ||
| 93 | |||
| 94 | See L<for more information|https://developer.mozilla.org/en-US/docs/Web/API/ErrorEvent> | ||
| 95 | |||
| 96 | =head1 COPYRIGHT & LICENSE | ||
| 97 | |||
| 98 | Copyright(c) 2021 DEGUEST Pte. Ltd. | ||
| 99 | |||
| 100 | All rights reserved | ||
| 101 | |||
| 102 | This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. | ||
| 103 | |||
| 104 | =cut |