Test::Builder2::EventWatcher - A role which watches events and results
package My::EventWatcher; use Test::Builder2::Mouse; with "Test::Builder2::EventWatcher"; sub accept_event { ... } no Test::Builder2::Mouse;
An EventWatcher is made known to an EventCoordinator which gives it Events and Results to do whatever it wants with. EventWatchers can be used to record events for future use (such as Test::Builder2::History), to take an action like producing output (such as Test::Builder2::Formatter) or even modifying the event itself.
When writing an EventWatcher you must supply these methods.
$event_watcher->accept_event($event); $event_watcher->accept_event($event, $event_coordinator);
An EventWatcher will be handed Event objects to do whatever it wants to with via this method.
accept_event is allowed to alter the $event. Be aware those changes will be visible to other EventWatchers.
accept_event
It may also be given the $event_coordinator which is managing the $event. This allows a watcher to issue their own Events.
You must implement this method.
The EventWatcher role supplies these methods.
$event_watcher->accept_result($result); $event_watcher->accept_result($result, $event_coordinator);
Just like accept_event except it handles Results (which are a special type of Event). It is there to make special case handling of Results a little more convenient.
The provided accept_result simply passes through to accept_event.
accept_result
To install Test::Simple, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Test::Simple
CPAN shell
perl -MCPAN -e shell install Test::Simple
For more information on module installation, please visit the detailed CPAN module installation guide.