Permalink
Browse files

Fix tab damage. No significant changes.

  • Loading branch information...
1 parent 701249a commit afd7c10c1b56d8c88a38864670c311cda3733623 @rcaputo committed Feb 13, 2010
View
@@ -5,21 +5,21 @@
use lib qw(../lib);
{
- package App;
- use Moose;
- extends 'Reflex::Object';
- use Reflex::Timer;
+ package App;
+ use Moose;
+ extends 'Reflex::Object';
+ use Reflex::Timer;
- has ticker => (
- isa => 'Reflex::Timer',
- is => 'rw',
- setup => { interval => 1, auto_repeat => 1 },
- traits => [ 'Reflex::Trait::Observer' ],
- );
+ has ticker => (
+ isa => 'Reflex::Timer',
+ is => 'rw',
+ setup => { interval => 1, auto_repeat => 1 },
+ traits => [ 'Reflex::Trait::Observer' ],
+ );
- sub on_ticker_tick {
- print "tick at ", scalar(localtime), "...\n";
- }
+ sub on_ticker_tick {
+ print "tick at ", scalar(localtime), "...\n";
+ }
}
exit App->new()->run_all();
@@ -5,13 +5,13 @@
use lib qw(../lib);
{
- package App;
- use Moose;
- extends 'Reflex::Timer';
+ package App;
+ use Moose;
+ extends 'Reflex::Timer';
- sub on_my_tick {
- print "tick at ", scalar(localtime), "...\n";
- }
+ sub on_my_tick {
+ print "tick at ", scalar(localtime), "...\n";
+ }
}
exit App->new(interval => 1, auto_repeat => 1)->run_all();
@@ -7,13 +7,13 @@
use lib qw(../lib);
{
- package App;
- use Reflex::Timer;
- use base qw(Reflex::Timer);
+ package App;
+ use Reflex::Timer;
+ use base qw(Reflex::Timer);
- sub on_my_tick {
- print "tick at ", scalar(localtime), "...\n";
- }
+ sub on_my_tick {
+ print "tick at ", scalar(localtime), "...\n";
+ }
}
exit App->new(interval => 1, auto_repeat => 1)->run_all();
@@ -7,28 +7,28 @@
use lib qw(../lib);
{
- package App;
- use Reflex::Object;
- use Reflex::Timer;
- use base qw(Reflex::Object);
-
- sub BUILD {
- my $self = shift;
-
- $self->{ticker} = Reflex::Timer->new(
- interval => 1,
- auto_repeat => 1,
- );
-
- $self->observe_role(
- observed => $self->{ticker},
- role => "ticker",
- );
- }
-
- sub on_ticker_tick {
- print "tick at ", scalar(localtime), "...\n";
- }
+ package App;
+ use Reflex::Object;
+ use Reflex::Timer;
+ use base qw(Reflex::Object);
+
+ sub BUILD {
+ my $self = shift;
+
+ $self->{ticker} = Reflex::Timer->new(
+ interval => 1,
+ auto_repeat => 1,
+ );
+
+ $self->observe_role(
+ observed => $self->{ticker},
+ role => "ticker",
+ );
+ }
+
+ sub on_ticker_tick {
+ print "tick at ", scalar(localtime), "...\n";
+ }
}
exit App->new()->run_all();
View
@@ -20,18 +20,18 @@
# Create a thing that will invoke callbacks.
{
- package PromiseThing;
- use Moose;
- extends 'Reflex::Object';
- use Reflex::Timer;
+ package PromiseThing;
+ use Moose;
+ extends 'Reflex::Object';
+ use Reflex::Timer;
use Reflex::Callbacks qw(gather_cb);
- has ticker => (
- isa => 'Reflex::Timer',
- is => 'rw',
- setup => { interval => 1, auto_repeat => 1 },
- traits => [ 'Reflex::Trait::Observer' ],
- );
+ has ticker => (
+ isa => 'Reflex::Timer',
+ is => 'rw',
+ setup => { interval => 1, auto_repeat => 1 },
+ traits => [ 'Reflex::Trait::Observer' ],
+ );
has cb => ( is => 'rw', isa => 'Reflex::Callbacks' );
@@ -40,10 +40,10 @@
$self->cb(gather_cb($arg));
}
- sub on_ticker_tick {
+ sub on_ticker_tick {
my $self = shift;
$self->cb()->send( event => {} );
- }
+ }
}
use Reflex::Callbacks qw(cb_promise);
View
@@ -54,37 +54,37 @@ Reflex::POE::Session - Observe events from a POE::Session object.
# Not a complete example.
# Please see eg-13-irc-bot.pl in the examples for one.
- has poco_watcher => (
- isa => 'Reflex::POE::Session',
- is => 'rw',
- traits => ['Reflex::Trait::Observer'],
- role => 'poco',
- );
-
- sub BUILD {
- my $self = shift;
-
- $self->component(
- POE::Component::IRC->spawn(
- nick => "reflex_$$",
- ircname => "Reflex Test Bot",
- server => "10.0.0.25",
- ) || die "Drat: $!"
- );
-
- $self->poco_watcher(
- Reflex::POE::Session->new(
- sid => $self->component()->session_id(),
- )
- );
-
- $self->run_within_session(
- sub {
- $self->component()->yield(register => "all");
- $self->component()->yield(connect => {});
- }
- )
- }
+ has poco_watcher => (
+ isa => 'Reflex::POE::Session',
+ is => 'rw',
+ traits => ['Reflex::Trait::Observer'],
+ role => 'poco',
+ );
+
+ sub BUILD {
+ my $self = shift;
+
+ $self->component(
+ POE::Component::IRC->spawn(
+ nick => "reflex_$$",
+ ircname => "Reflex Test Bot",
+ server => "10.0.0.25",
+ ) || die "Drat: $!"
+ );
+
+ $self->poco_watcher(
+ Reflex::POE::Session->new(
+ sid => $self->component()->session_id(),
+ )
+ );
+
+ $self->run_within_session(
+ sub {
+ $self->component()->yield(register => "all");
+ $self->component()->yield(connect => {});
+ }
+ )
+ }
TODO - Either complete the example, or find a shorter one.
@@ -123,36 +123,36 @@ Reflex::POE::Wheel::Run - Allow a Reflex class to represent POE::Wheel::Run.
# Not a complete example. Please see eg-07-wheel-run.pl or even
# better eg-08-observer-trait.pl for working examples.
- has child => (
- traits => ['Reflex::Trait::Observer'],
- isa => 'Reflex::POE::Wheel::Run|Undef',
- is => 'rw',
- );
-
- sub BUILD {
- my $self = shift;
- $self->child(
- Reflex::POE::Wheel::Run->new(
- Program => "$^X -wle 'print qq[pid(\$\$) moo(\$_)] for 1..10; exit'",
- )
- );
- }
-
- sub on_child_stdout {
- my ($self, $args) = @_;
- print "stdout: $args->{output}\n";
- }
-
- sub on_child_close {
- my ($self, $args) = @_;
- print "child closed all output\n";
- }
-
- sub on_child_signal {
- my ($self, $args) = @_;
- print "child $args->{pid} exited: $args->{exit}\n";
- $self->child(undef);
- }
+ has child => (
+ traits => ['Reflex::Trait::Observer'],
+ isa => 'Reflex::POE::Wheel::Run|Undef',
+ is => 'rw',
+ );
+
+ sub BUILD {
+ my $self = shift;
+ $self->child(
+ Reflex::POE::Wheel::Run->new(
+ Program => "$^X -wle 'print qq[pid(\$\$) moo(\$_)] for 1..10; exit'",
+ )
+ );
+ }
+
+ sub on_child_stdout {
+ my ($self, $args) = @_;
+ print "stdout: $args->{output}\n";
+ }
+
+ sub on_child_close {
+ my ($self, $args) = @_;
+ print "child closed all output\n";
+ }
+
+ sub on_child_signal {
+ my ($self, $args) = @_;
+ print "child $args->{pid} exited: $args->{exit}\n";
+ $self->child(undef);
+ }
TODO - Needs a better example.

0 comments on commit afd7c10

Please sign in to comment.