Commit 5dad355a0f8cb01fca8cd0d16f47041c4576605a

Create some examples where Reflex is used without Moose.
MANIFEST
(3 / 1)
  
1
21CHANGES
32MANIFEST
43META.yml
2121eg/eg-13-irc-bot.pl
2222eg/eg-14-synopsis.pl
2323eg/eg-15-handle.pl
24eg/eg-16-timer-inheritance.pl
25eg/eg-17-inheritance-no-moose.pl
26eg/eg-18-synopsis-no-moose.pl
2427lib/Reflex.pm
2528lib/Reflex/Handle.pm
2629lib/Reflex/Object.pm
  
6767 [X] 100% Containership rules are delegated to the objects themselves.
6868 [_] 50% Runtime roles may be assigned as part of the observation, not the sub-object.
6969 [_] 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.
7074 [X] 100% Default handler method names may be derived from roles and message types.
7175 Sender is a DNS resolver.
7276 Sender's role is "resolver".
8484 [X] 100% Class Inheritance Rules
8585 [X] 100% Class inheritance rules are delegated to Moose.
8686 [_] 22% Messaging Requirements
87 [_] 0% Object command interfaces must be objects.
87 [_] 0% Object command interfaces must be methods.
8888 [_] 0% Methods on the objects themselves may pass messages into themselves.
8989 Synchronous method calls are translated into asynchronous messages.
9090 [_] 0% Methods on the objects may trigger activity that emits new events.
  
1#!/usr/bin/env perl
2
3use warnings;
4use strict;
5use 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
17exit App->new(interval => 1, auto_repeat => 1)->run_all();
  
1#!/usr/bin/env perl
2
3# Inherit Reflex without Moose. For people who don't like Moose.
4
5use warnings;
6use strict;
7use 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
19exit App->new(interval => 1, auto_repeat => 1)->run_all();
  
1#!/usr/bin/env perl
2
3# Use Reflex without Moose. For people who don't like Moose.
4
5use warnings;
6use strict;
7use 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
34exit App->new()->run_all();