Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 34 lines (25 sloc) 0.575 kb
5dad355 @rcaputo Create some examples where Reflex is used without Moose.
authored
1 #!/usr/bin/env perl
5b0127b @rcaputo Remove emit() from roles.
authored
2 # vim: ts=2 sw=2 noexpandtab
5dad355 @rcaputo Create some examples where Reflex is used without Moose.
authored
3
4 # Use Reflex without Moose. For people who don't like Moose.
5
6 use warnings;
7 use strict;
8 use lib qw(../lib);
9
10 {
afd7c10 @rcaputo Fix tab damage. No significant changes.
authored
11 package App;
1f5ed27 @rcaputo Rename Reflex::Role::Object to Reflex::Role::Reactive; Reflex::Object to...
authored
12 use Reflex::Base;
bbf149d @rcaputo Create Reflex::Role::Interval, and reify it as Reflex::Interval. Needed...
authored
13 use Reflex::Interval;
3af6b57 @rcaputo Initial Reflex::Callbacks integration into Reflex at large.
authored
14 use Reflex::Callbacks qw(cb_role);
1f5ed27 @rcaputo Rename Reflex::Role::Object to Reflex::Role::Reactive; Reflex::Object to...
authored
15 use base qw(Reflex::Base);
afd7c10 @rcaputo Fix tab damage. No significant changes.
authored
16
17 sub BUILD {
18 my $self = shift;
19
bbf149d @rcaputo Create Reflex::Role::Interval, and reify it as Reflex::Interval. Needed...
authored
20 $self->{ticker} = Reflex::Interval->new(
3af6b57 @rcaputo Initial Reflex::Callbacks integration into Reflex at large.
authored
21 interval => 1,
afd7c10 @rcaputo Fix tab damage. No significant changes.
authored
22 auto_repeat => 1,
23 );
24
5f9458c @rcaputo Rename observe() to watch(). Rename wait() to next().
authored
25 $self->watch($self->{ticker}, cb_role($self, "ticker"));
afd7c10 @rcaputo Fix tab damage. No significant changes.
authored
26 }
27
28 sub on_ticker_tick {
29 print "tick at ", scalar(localtime), "...\n";
30 }
5dad355 @rcaputo Create some examples where Reflex is used without Moose.
authored
31 }
32
33 exit App->new()->run_all();
Something went wrong with that request. Please try again.