The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Evented::Object::Collection - represents a group of pending Evented::Object callbacks.

DESCRIPTION

"Collections" are returned by the evented object 'prepare' methods. They represent a group of callbacks that are about to be fired. Using collections allows you to prepare a fire ahead of time before executing it. You can also fire events with special options this way.

METHODS

$col->fire(@options)

Fires the pending callbacks with the specified options, if any. If the callbacks have not yet been sorted, they are sorted before the event is fired.

 $eo->prepare(some_event => @arguments)->fire('safe');

Parameters

  • @options - optional, a mixture of boolean and key:value options for the event fire.

@options - fire options

  • caller - requires value, use an alternate [caller 1] value for the event fire. This is typically only used internally.

  • return_check - boolean, if true, the event will yield that it was stopped if any of the callbacks return a false value. Note however that if one callbacks returns false, the rest will still be called. The fire object will only yield stopped status after all callbacks have been called and any number of them returned false.

  • safe - boolean, wrap all callback calls in eval for safety. if any of them fail, the event will be stopped at that point with the error.

  • fail_continue - boolean, if safe above is enabled, this tells the fire to continue even if one of the callbacks fails. This could be dangerous if any of the callbacks expected a previous callback to be done when it actually failed.

  • data - requires value, a scalar value that can be fetched by $fire->data from within the callbacks. Good for data that might be useful sometimes but not frequently enough to deserve a spot in the argument list. If data is a hash reference, its values can be fetched conveniently with $fire->data('key').

$col->sort

Sorts the callbacks according to priority, before, and after options.

AUTHOR

Mitchell Cooper <cooper@cpan.org>

Copyright © 2011-2017. Released under New BSD license.

Comments, complaints, and recommendations are accepted. Bugs may be reported on GitHub.