Commit 5dad355a0f8cb01fca8cd0d16f47041c4576605a
- Diff rendering mode:
- inline
- side by side
MANIFEST
(3 / 1)
|   | |||
| 1 | |||
| 2 | 1 | CHANGES | |
| 3 | 2 | MANIFEST | |
| 4 | 3 | META.yml | |
| … | … | ||
| 21 | 21 | eg/eg-13-irc-bot.pl | |
| 22 | 22 | eg/eg-14-synopsis.pl | |
| 23 | 23 | eg/eg-15-handle.pl | |
| 24 | eg/eg-16-timer-inheritance.pl | ||
| 25 | eg/eg-17-inheritance-no-moose.pl | ||
| 26 | eg/eg-18-synopsis-no-moose.pl | ||
| 24 | 27 | lib/Reflex.pm | |
| 25 | 28 | lib/Reflex/Handle.pm | |
| 26 | 29 | lib/Reflex/Object.pm |
docs/requirements.otl
(5 / 1)
|   | |||
| 67 | 67 | [X] 100% Containership rules are delegated to the objects themselves. | |
| 68 | 68 | [_] 50% Runtime roles may be assigned as part of the observation, not the sub-object. | |
| 69 | 69 | [_] 0% Multiple watchers may have the same runtime role. | |
| 70 | This is already possible. | ||
| 71 | Currently roles address watchers. | ||
| 72 | Multiple watchers for a role requires additional addressing. | ||
| 73 | Possibly passing the watcher object into the callback. | ||
| 70 | 74 | [X] 100% Default handler method names may be derived from roles and message types. | |
| 71 | 75 | Sender is a DNS resolver. | |
| 72 | 76 | Sender's role is "resolver". | |
| … | … | ||
| 84 | 84 | [X] 100% Class Inheritance Rules | |
| 85 | 85 | [X] 100% Class inheritance rules are delegated to Moose. | |
| 86 | 86 | [_] 22% Messaging Requirements | |
| 87 | [_] 0% Object command interfaces must be objects. | ||
| 87 | [_] 0% Object command interfaces must be methods. | ||
| 88 | 88 | [_] 0% Methods on the objects themselves may pass messages into themselves. | |
| 89 | 89 | Synchronous method calls are translated into asynchronous messages. | |
| 90 | 90 | [_] 0% Methods on the objects may trigger activity that emits new events. |
eg/eg-16-timer-inheritance.pl
(17 / 0)
|   | |||
| 1 | #!/usr/bin/env perl | ||
| 2 | |||
| 3 | use warnings; | ||
| 4 | use strict; | ||
| 5 | use lib qw(../lib); | ||
| 6 | |||
| 7 | { | ||
| 8 | package App; | ||
| 9 | use Moose; | ||
| 10 | extends 'Reflex::Timer'; | ||
| 11 | |||
| 12 | sub on_my_tick { | ||
| 13 | print "tick at ", scalar(localtime), "...\n"; | ||
| 14 | } | ||
| 15 | } | ||
| 16 | |||
| 17 | exit App->new(interval => 1, auto_repeat => 1)->run_all(); |
eg/eg-17-inheritance-no-moose.pl
(19 / 0)
|   | |||
| 1 | #!/usr/bin/env perl | ||
| 2 | |||
| 3 | # Inherit Reflex without Moose. For people who don't like Moose. | ||
| 4 | |||
| 5 | use warnings; | ||
| 6 | use strict; | ||
| 7 | use lib qw(../lib); | ||
| 8 | |||
| 9 | { | ||
| 10 | package App; | ||
| 11 | use Reflex::Timer; | ||
| 12 | use base qw(Reflex::Timer); | ||
| 13 | |||
| 14 | sub on_my_tick { | ||
| 15 | print "tick at ", scalar(localtime), "...\n"; | ||
| 16 | } | ||
| 17 | } | ||
| 18 | |||
| 19 | exit App->new(interval => 1, auto_repeat => 1)->run_all(); |
eg/eg-18-synopsis-no-moose.pl
(34 / 0)
|   | |||
| 1 | #!/usr/bin/env perl | ||
| 2 | |||
| 3 | # Use Reflex without Moose. For people who don't like Moose. | ||
| 4 | |||
| 5 | use warnings; | ||
| 6 | use strict; | ||
| 7 | use lib qw(../lib); | ||
| 8 | |||
| 9 | { | ||
| 10 | package App; | ||
| 11 | use Reflex::Object; | ||
| 12 | use Reflex::Timer; | ||
| 13 | use base qw(Reflex::Object); | ||
| 14 | |||
| 15 | sub BUILD { | ||
| 16 | my $self = shift; | ||
| 17 | |||
| 18 | $self->{ticker} = Reflex::Timer->new( | ||
| 19 | interval => 1, | ||
| 20 | auto_repeat => 1, | ||
| 21 | ); | ||
| 22 | |||
| 23 | $self->observe_role( | ||
| 24 | observed => $self->{ticker}, | ||
| 25 | role => "ticker", | ||
| 26 | ); | ||
| 27 | } | ||
| 28 | |||
| 29 | sub on_ticker_tick { | ||
| 30 | print "tick at ", scalar(localtime), "...\n"; | ||
| 31 | } | ||
| 32 | } | ||
| 33 | |||
| 34 | exit App->new()->run_all(); |

