NAME

Reflex - Class library for flexible, reactive programs.

VERSION

This document describes version 0.100, released on April 02, 2017.

SYNOPSIS

The distribution includes a few different versions of this synopsis. See eg/eg-18-synopsis-no-moose.pl if you don't like Moose. See eg/eg-32-promise-tiny.pl if you prefer promises (condvar-like). See eg/eg-36-coderefs-tiny.pl if you prefer coderefs and/or closures.

DESCRIPTION

Reflex is a class library that assists with writing reactive (AKA event-driven) programs. Reflex uses Moose internally, but it doesn't enforce programs to use Moose's syntax.

Those who enjoy Moose should find useful Reflex's comprehensive suite of reactive roles.

Reflex is considered "reactive" because it's an implementation of the reactor pattern. http://en.wikipedia.org/wiki/Reactor_pattern

About Reactive Objects

Reactive objects provide responses to interesting (to them) stimuli. For example, an object might be waiting for input from a client, a signal from an administrator, a particular time of day, and so on. The App object in the SYNOPSIS is waiting for timer tick events. It generates console messages in response to those events.

Example Reactive Objects

Here an Echoer class emits "pong" events in response to ping() commands. It uses Moose's extends(), but it could about as easily use warnings, strict, and base instead. Reflex::Base gets its emit() method from Reflex::Role::Reactive.

The next object uses Echoer. It creates an Echoer and pings it to get started. It also reacts to "pong" events by pinging the Echoer again. Reflex::Trait::Watched (via its exported watches() declarative syntax) implicitly watches the object in echoer(), mapping its "pong" event to the on_echoer_pong() method.

A complete, runnable version of the above example is available as eg/eg-36-tiny-coderefs.pl in the distribution.

Promises Instead of Callbacks

Callback haters are not left out. Reflex objects may also be used as asynchronous event generators. The following example is identical in function to the previous coderef callback example, but it doesn't use callbacks at all.

It may not be obvious that the same emit() method drives all of Reflex's forms of callback. The same Reflex::Interval class can be used in many different ways.

Reflex::Trait::EmitsOnChange - Cause a Moose attribute to emit() an event when it changes.

Reflex::Trait::Observed - (Deprecated. See Reflex::Trait::Watched.)

ASSISTANCE

Thank you for volunteering to assist with this project. You can find like-minded people in a few places, in descending order of preference. Or, oh, wait, maybe you wanted assistance using it? We'll help you, too. :)

See irc.perl.org #reflex for help with Reflex.

See irc.perl.org #poe for help with POE and Reflex.

See irc.perl.org #moose for help with Moose.

Support is officially available from POE's mailing list as well. Send a blank message to poe-subscribe@perl.org to join.

The Reflex package also has helpful examples which may serve as a tutorial until Reflex is documented more.

Email

You can email the author of this module at poe-subscribe@perl.org asking for help with any problems you have.

Internet Relay Chat

You can get live help by using IRC ( Internet Relay Chat ). If you don't know what IRC is, please read this excellent guide: http://en.wikipedia.org/wiki/Internet_Relay_Chat. Please be courteous and patient when talking to us, as we might be busy or sleeping! You can join those networks/channels and get help:

irc.perl.org

You can connect to the server at 'irc.perl.org' and join this channel: #reflex to get help.

Source Code

The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :)

git clone git://github.com/rcaputo/reflex.git

BUGS AND LIMITATIONS

AUTHOR

Rocco Caputo <rcaputo@cpan.org>

ACKNOWLEDGEMENTS

irc.perl.org channel #moose and #poe. The former for assisting in learning their fine libraries, sometimes against everyone's better judgement. The latter for putting up with lengthy and sometimes irrelevant design discussion for oh so long.

COPYRIGHT AND LICENSE

This software is copyright (c) 2017 by Rocco Caputo.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

DISCLAIMER OF WARRANTY

BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.

IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

Module Install Instructions

To install Reflex, simply copy and paste either of the commands in to your terminal

As a valued partner and proud supporter of MetaCPAN, StickerYou is
happy to offer a 10% discount on all Custom Stickers,
Business Labels, Roll Labels,
Vinyl Lettering or Custom Decals. StickerYou.com
is your one-stop shop to make your business stick.
Use code METACPAN10 at checkout to apply your discount.