Math::ModInt::Event::Trap - catching events triggered by Math::ModInt
This documentation refers to version 0.013 of Math::ModInt::Event::Trap.
# event consumer interface: use Math::ModInt::Event::Trap; sub my_handler { my ($event) = @_; # ... insert code here ... return 0; # call no handler after this one return 1; # continue calling subsequent handlers } $trap = Math::ModInt::Event::Trap->new($event, \&my_handler); $trap = Math::ModInt::Event::Trap->new($event, 'ignore'); $trap = Math::ModInt::Event::Trap->new($event, 'warn'); $trap = Math::ModInt::Event::Trap->new($event, 'die'); undef $trap; # discard this trap Math::ModInt::Event::Trap->new($event, \&my_handler); Math::ModInt::Event::Trap->new($event, 'ignore'); Math::ModInt::Event::Trap->new($event, 'warn'); Math::ModInt::Event::Trap->new($event, 'die'); # event producer interface: Math::ModInt::Event::Trap->broadcast($event);
This module is closely related to Math::ModInt::Event and should in general not be directly accessed from application code. Please refer to Math::ModInt::Event for a more user-friendly description of both module's functionalities.
Constructor, takes an event object, and a handler coderef or a generic handler name. Returns the new trap object.
Notifies active event handlers of an event. Takes an event, returns the number of handlers called.
Math::ModInt::Event::Trap has no exports.
Standard warning handlers print "warning: " and the short description of the event (like "undefined result") on STDERR, followed by a caller source code location.
"warning: "
"undefined result"
Standard error handlers die with "error: " and the short description of the event (like "undefined result").
"error: "
Math::ModInt::Event
Math::ModInt
Martin Becker, <becker-cpan-mp at cozap.com>
Copyright (c) 2010-2021 Martin Becker, Blaubeuren.
This library is free software; you can distribute it and/or modify it under the terms of the Artistic License 2.0 (see LICENSE file). at your option, any later version of Perl 5 you may have available.
This library is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose.
To install Math::ModInt, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Math::ModInt
CPAN shell
perl -MCPAN -e shell install Math::ModInt
For more information on module installation, please visit the detailed CPAN module installation guide.