Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Rename "observe" to "watch".

It's shorter, and it aligns the names of things with what node.js
people understand.
  • Loading branch information...
commit 9513af3bd7026db10548a3071870be7a2e21749f 1 parent 20c1bb9
@rcaputo authored
Showing with 130 additions and 132 deletions.
  1. +2 −2 eg/RunnerRole.pm
  2. +2 −2 eg/eg-05-composition.pl
  3. +2 −2 eg/{eg-08-observer-trait.pl → eg-08-watched-trait.pl}
  4. +2 −2 eg/eg-13-irc-bot.pl
  5. +2 −2 eg/eg-14-synopsis.pl
  6. +2 −2 eg/eg-37-ping-pong.pl
  7. +2 −2 eg/eg-60-collection-promise.pl
  8. +10 −10 eg/ttl/Ttl/Adder.pm
  9. +7 −7 eg/ttl/Ttl/FlipFlop/D.pm
  10. +4 −4 eg/ttl/Ttl/FlipFlop/JK.pm
  11. +4 −4 eg/ttl/Ttl/FlipFlop/MasterSlave.pm
  12. +2 −2 eg/ttl/Ttl/FlipFlop/T.pm
  13. +4 −4 eg/ttl/Ttl/Latch/ClockedNandRS.pm
  14. +5 −5 eg/ttl/Ttl/Latch/NandRS.pm
  15. +5 −5 eg/ttl/Ttl/Latch/NorRS.pm
  16. +3 −3 eg/ttl/Ttl/Nand.pm
  17. +3 −3 eg/ttl/Ttl/Nor.pm
  18. +4 −4 eg/ttl/Ttl/TriAnd.pm
  19. +4 −4 eg/ttl/Ttl/TriNand.pm
  20. +10 −10 eg/ttl/fail-ttl-counter.pl
  21. +2 −2 eg/ttl/fail-ttl-simple.pl
  22. +13 −13 lib/Reflex.pm
  23. +2 −2 lib/Reflex/Client.pm
  24. +2 −2 lib/Reflex/PID.pm
  25. +1 −1  lib/Reflex/POE/Session.pm
  26. +4 −4 lib/Reflex/POE/Wheel/Run.pm
  27. +1 −1  lib/Reflex/Role/Reactive.pm
  28. +1 −1  lib/Reflex/Sender.pm
  29. +1 −1  lib/Reflex/Trait/EmitsOnChange.pm
  30. +11 −11 lib/Reflex/Trait/{Observed.pm → Watched.pm}
  31. +1 −1  lib/Reflex/UdpPeer.pm
  32. +0 −2  t/{101-discrete-observer.t → 101-discrete-watcher.t}
  33. 0  t/{102-observed-new.t → 102-watched-new.t}
  34. 0  t/{103-observer-roles.t → 103-watcher-roles.t}
  35. +5 −5 t/104-emitter-trait.t
  36. +5 −5 t/105-setup.t
  37. +2 −2 t/125-rcb-promise.t
View
4 eg/RunnerRole.pm
@@ -77,7 +77,7 @@ __END__
extends 'Reflex::Base';
-use Reflex::Trait::Observed;
+use Reflex::Trait::Watched;
use Reflex::PID;
use Carp qw(croak);
@@ -87,7 +87,7 @@ use Symbol qw(gensym);
__END__
-observes process => ( isa => 'Maybe[Reflex::PID]', is => 'rw' );
+watches process => ( isa => 'Maybe[Reflex::PID]', is => 'rw' );
has [qw(stdin stdout stderr)] => (
isa => 'Maybe[FileHandle]',
View
4 eg/eg-05-composition.pl
@@ -13,14 +13,14 @@
use Moose;
extends 'Reflex::Base';
use Reflex::UdpPeer;
- use Reflex::Trait::Observed qw(observes);
+ use Reflex::Trait::Watched qw(watches);
has port => (
isa => 'Int',
is => 'ro',
);
- observes peer => (
+ watches peer => (
isa => 'Maybe[Reflex::UdpPeer]',
setup => sub {
my $self = shift;
View
4 eg/eg-08-observer-trait.pl → eg/eg-08-watched-trait.pl
@@ -12,9 +12,9 @@
use Moose;
extends 'Reflex::Base';
use Reflex::POE::Wheel::Run;
- use Reflex::Trait::Observed;
+ use Reflex::Trait::Watched;
- observes child => (
+ watches child => (
isa => 'Maybe[Reflex::POE::Wheel::Run]',
);
View
4 eg/eg-13-irc-bot.pl
@@ -13,7 +13,7 @@
use Moose;
extends 'Reflex::Base';
use Reflex::POE::Session;
- use Reflex::Trait::Observed;
+ use Reflex::Trait::Watched;
use POE qw(Component::IRC);
@@ -22,7 +22,7 @@
is => 'rw',
);
- observes poco_watcher => (
+ watches poco_watcher => (
isa => 'Reflex::POE::Session',
role => 'poco',
);
View
4 eg/eg-14-synopsis.pl
@@ -9,9 +9,9 @@
use Moose;
extends 'Reflex::Base';
use Reflex::Interval;
- use Reflex::Trait::Observed;
+ use Reflex::Trait::Watched;
- observes ticker => (
+ watches ticker => (
isa => 'Reflex::Interval',
setup => { interval => 1, auto_repeat => 1 },
);
View
4 eg/eg-37-ping-pong.pl
@@ -18,9 +18,9 @@
package Pinger;
use Moose;
extends 'Reflex::Base';
- use Reflex::Trait::Observed;
+ use Reflex::Trait::Watched;
- observes echoer => (
+ watches echoer => (
isa => 'Echoer',
default => sub { Echoer->new() },
);
View
4 eg/eg-60-collection-promise.pl
@@ -56,7 +56,7 @@
use Moose;
with 'Reflex::Role::Collectible';
extends 'Reflex::Base'; # TODO - Implicit in Reflex::Role::Collectible?
- use Reflex::Trait::Observed;
+ use Reflex::Trait::Watched;
use Reflex::Interval;
has id => (
@@ -70,7 +70,7 @@
default => 0,
);
- observes timer => (
+ watches timer => (
is => 'rw',
isa => 'Maybe[Reflex::Interval]',
setup => sub {
View
20 eg/ttl/Ttl/Adder.pm
@@ -32,16 +32,16 @@ use Ttl::Xor;
use Ttl::And;
use Ttl::Or;
-emits a => ( isa => 'Bool' );
-emits b => ( isa => 'Bool' );
-emits cin => ( isa => 'Bool' );
-observes xor_ab => ( isa => 'Ttl::Xor' );
-observes xor_cin => ( isa => 'Ttl::Xor' );
-observes and_ab => ( isa => 'Ttl::And' );
-observes and_cin => ( isa => 'Ttl::And' );
-observes or_cout => ( isa => 'Ttl::Or' );
-emits sum => ( isa => 'Bool' );
-emits cout => ( isa => 'Bool' );
+emits a => ( isa => 'Bool' );
+emits b => ( isa => 'Bool' );
+emits cin => ( isa => 'Bool' );
+watches xor_ab => ( isa => 'Ttl::Xor' );
+watches xor_cin => ( isa => 'Ttl::Xor' );
+watches and_ab => ( isa => 'Ttl::And' );
+watches and_cin => ( isa => 'Ttl::And' );
+watches or_cout => ( isa => 'Ttl::Or' );
+emits sum => ( isa => 'Bool' );
+emits cout => ( isa => 'Bool' );
sub on_my_a {
my ($self, $args) = @_;
View
14 eg/ttl/Ttl/FlipFlop/D.pm
@@ -11,7 +11,7 @@ extends 'Reflex::Base';
use Ttl::TriNand;
use Reflex::Trait::EmitsOnChange;
-use Reflex::Trait::Observed;
+use Reflex::Trait::Watched;
emits clear => ( isa => 'Bool' );
emits clock => ( isa => 'Bool' );
@@ -100,11 +100,11 @@ sub on_tri6_out {
$self->tri5->c($args->{value});
}
-observes tri1 => ( isa => 'Ttl::TriNand' );
-observes tri2 => ( isa => 'Ttl::TriNand' );
-observes tri3 => ( isa => 'Ttl::TriNand' );
-observes tri4 => ( isa => 'Ttl::TriNand' );
-observes tri5 => ( isa => 'Ttl::TriNand' );
-observes tri6 => ( isa => 'Ttl::TriNand' );
+watches tri1 => ( isa => 'Ttl::TriNand' );
+watches tri2 => ( isa => 'Ttl::TriNand' );
+watches tri3 => ( isa => 'Ttl::TriNand' );
+watches tri4 => ( isa => 'Ttl::TriNand' );
+watches tri5 => ( isa => 'Ttl::TriNand' );
+watches tri6 => ( isa => 'Ttl::TriNand' );
1;
View
8 eg/ttl/Ttl/FlipFlop/JK.pm
@@ -23,22 +23,22 @@ use Moose;
extends 'Reflex::Base';
use Ttl::Latch::ClockedNandRS;
-observes nand_j => (
+watches nand_j => (
isa => 'Ttl::Nand',
handles => { j => 'a' },
);
-observes nand_k => (
+watches nand_k => (
isa => 'Ttl::Nand',
handles => { k => 'b' },
);
-observes trinand_preset => (
+watches trinand_preset => (
isa => 'Ttl::TriNand',
handles => { preset => 'a' },
);
-observes trinand_clear => (
+watches trinand_clear => (
isa => 'Ttl::TriNand',
handles => { clear => 'c' },
);
View
8 eg/ttl/Ttl/FlipFlop/MasterSlave.pm
@@ -19,15 +19,15 @@ use Ttl::Latch::ClockedNandRS;
use Ttl::Not;
use Reflex::Trait::EmitsOnChange;
-use Reflex::Trait::Observed;
+use Reflex::Trait::Watched;
-observes cnrs1 => (
+watches cnrs1 => (
isa => 'Ttl::Latch::ClockedNandRS',
handles => ['r', 's'],
);
-observes cnrs2 => ( isa => 'Ttl::Latch::ClockedNandRS' );
-observes not => ( isa => 'Ttl::Not' );
+watches cnrs2 => ( isa => 'Ttl::Latch::ClockedNandRS' );
+watches not => ( isa => 'Ttl::Not' );
sub BUILD {
my $self = shift;
View
4 eg/ttl/Ttl/FlipFlop/T.pm
@@ -7,10 +7,10 @@ use Moose;
extends 'Reflex::Base';
use Ttl::FlipFlop::D;
-use Reflex::Trait::Observed;
+use Reflex::Trait::Watched;
use Reflex::Trait::EmitsOnChange;
-observes dff => (
+watches dff => (
isa => 'Ttl::FlipFlop::D',
handles => ['preset','clear','clock'],
);
View
8 eg/ttl/Ttl/Latch/ClockedNandRS.pm
@@ -19,10 +19,10 @@ use Ttl::Nand;
use Ttl::Latch::NandRS;
use Reflex::Trait::EmitsOnChange;
-use Reflex::Trait::Observed;
+use Reflex::Trait::Watched;
-observes nand_not_r => ( isa => 'Ttl::Nand', handles => { not_r => 'b' } );
-observes nand_s => ( isa => 'Ttl::Nand', handles => { s => 'a' } );
+watches nand_not_r => ( isa => 'Ttl::Nand', handles => { not_r => 'b' } );
+watches nand_s => ( isa => 'Ttl::Nand', handles => { s => 'a' } );
emits clk => ( isa => 'Bool' );
sub on_my_clk {
@@ -31,7 +31,7 @@ sub on_my_clk {
$self->nand_not_r()->a($args->{value});
}
-observes latch => ( isa => 'Ttl::Latch::NandRS' );
+watches latch => ( isa => 'Ttl::Latch::NandRS' );
sub BUILD {
my $self = shift;
View
10 eg/ttl/Ttl/Latch/NandRS.pm
@@ -19,13 +19,13 @@ use Moose;
extends 'Reflex::Base';
use Ttl::Nand;
-use Reflex::Trait::Observed;
+use Reflex::Trait::Watched;
use Reflex::Trait::EmitsOnChange;
-observes nand_r => ( isa => 'Ttl::Nand', handles => { r => 'b' } );
-observes nand_s => ( isa => 'Ttl::Nand', handles => { s => 'a' } );
-emits q => ( isa => 'Bool' );
-emits not_q => ( isa => 'Bool' );
+watches nand_r => ( isa => 'Ttl::Nand', handles => { r => 'b' } );
+watches nand_s => ( isa => 'Ttl::Nand', handles => { s => 'a' } );
+emits q => ( isa => 'Bool' );
+emits not_q => ( isa => 'Bool' );
sub on_nand_s_out {
my ($self, $args) = @_;
View
10 eg/ttl/Ttl/Latch/NorRS.pm
@@ -19,13 +19,13 @@ use Moose;
extends 'Reflex::Base';
use Ttl::Nor;
-use Reflex::Trait::Observed;
+use Reflex::Trait::Watched;
use Reflex::Trait::EmitsOnChange;
-observes nor_r => ( isa => 'Ttl::Nor', handles => { r => 'a' } );
-observes nor_s => ( isa => 'Ttl::Nor', handles => { s => 'b' } );
-emits q => ( isa => 'Bool' );
-emits not_q => ( isa => 'Bool' );
+watches nor_r => ( isa => 'Ttl::Nor', handles => { r => 'a' } );
+watches nor_s => ( isa => 'Ttl::Nor', handles => { s => 'b' } );
+emits q => ( isa => 'Bool' );
+emits not_q => ( isa => 'Bool' );
sub on_nor_s_out {
my ($self, $args) = @_;
View
6 eg/ttl/Ttl/Nand.pm
@@ -13,15 +13,15 @@ extends 'Ttl::Bin';
use Ttl::Not;
use Ttl::And;
-use Reflex::Trait::Observed;
+use Reflex::Trait::Watched;
-observes and => (
+watches and => (
isa => 'Ttl::And',
handles => [qw(a b)],
setup => sub { Ttl::And->new() },
);
-observes not => (
+watches not => (
isa => 'Ttl::Not',
setup => sub { Ttl::Not->new() },
);
View
6 eg/ttl/Ttl/Nor.pm
@@ -13,11 +13,11 @@ extends 'Ttl::Bin';
use Ttl::Not;
use Ttl::Or;
-use Reflex::Role::Observed;
+use Reflex::Role::Watched;
# Ttl::Or handles a and b input for Ttl::Nor.
-observes or => ( isa => 'Ttl::Or', handles => [qw(a b)] );
-observes not => ( isa => 'Ttl::Not' );
+watches or => ( isa => 'Ttl::Or', handles => [qw(a b)] );
+watches not => ( isa => 'Ttl::Not' );
sub BUILD {
my $self = shift;
View
8 eg/ttl/Ttl/TriAnd.pm
@@ -21,12 +21,12 @@ use Moose;
extends 'Reflex::Base';
use Ttl::And;
-use Reflex::Trait::Observed;
+use Reflex::Trait::Watched;
use Reflex::Trait::EmitsOnChange;
-observes and_ab => ( isa => 'Ttl::And', handles => [qw(a b)] );
-observes and_c => ( isa => 'Ttl::And', handles => { c => 'b' } );
-emits out => ( isa => 'Bool' );
+watches and_ab => ( isa => 'Ttl::And', handles => [qw(a b)] );
+watches and_c => ( isa => 'Ttl::And', handles => { c => 'b' } );
+emits out => ( isa => 'Bool' );
sub BUILD {
my $self = shift;
View
8 eg/ttl/Ttl/TriNand.pm
@@ -22,11 +22,11 @@ use Ttl::TriAnd;
use Ttl::Not;
use Reflex::Trait::EmitsOnChange;
-use Reflex::Trait::Observed;
+use Reflex::Trait::Watched;
-observes tri_and => ( isa => 'Ttl::TriAnd', handles => [qw(a b c)] );
-observes not => ( isa => 'Ttl::Not' );
-emits out => ( isa => 'Bool' );
+watches tri_and => ( isa => 'Ttl::TriAnd', handles => [qw(a b c)] );
+watches not => ( isa => 'Ttl::Not' );
+emits out => ( isa => 'Bool' );
sub BUILD {
my $self = shift;
View
20 eg/ttl/fail-ttl-counter.pl
@@ -9,7 +9,7 @@
use Moose;
extends 'Reflex::Base';
use Reflex::Trait::EmitsOnChange;
- use Reflex::Trait::Observed;
+ use Reflex::Trait::Watched;
use Ttl::FlipFlop::T;
use Ttl::HexDecoder;
@@ -18,12 +18,12 @@
# The counter schematic comes from Don Lancaster's _TTL Cookbook_.
# Other sources (like www.play-hookey.com) seem to be flaky.
- observes t1 => ( isa => 'Ttl::FlipFlop::T', handles => ['clock'] );
- observes t2 => ( isa => 'Ttl::FlipFlop::T' );
- observes t4 => ( isa => 'Ttl::FlipFlop::T' );
- observes t8 => ( isa => 'Ttl::FlipFlop::T' );
- observes decoder => ( isa => 'Ttl::HexDecoder' );
- emits out => ( isa => 'Str' );
+ watches t1 => ( isa => 'Ttl::FlipFlop::T', handles => ['clock'] );
+ watches t2 => ( isa => 'Ttl::FlipFlop::T' );
+ watches t4 => ( isa => 'Ttl::FlipFlop::T' );
+ watches t8 => ( isa => 'Ttl::FlipFlop::T' );
+ watches decoder => ( isa => 'Ttl::HexDecoder' );
+ emits out => ( isa => 'Str' );
sub on_t1_q {
my ($self, $args) = @_;
@@ -82,10 +82,10 @@
use Moose;
extends 'Reflex::Base';
use Reflex::Interval;
- use Reflex::Trait::Observed;
+ use Reflex::Trait::Watched;
- observes counter => ( isa => 'Counter' );
- observes clock => ( isa => 'Reflex::Interval' );
+ watches counter => ( isa => 'Counter' );
+ watches clock => ( isa => 'Reflex::Interval' );
sub BUILD {
my $self = shift;
View
4 eg/ttl/fail-ttl-simple.pl
@@ -9,9 +9,9 @@
use Moose;
extends 'Reflex::Base';
use Ttl::And;
- use Reflex::Trait::Observed;
+ use Reflex::Trait::Watched;
- observes ander => ( isa => 'Ttl::And' );
+ watches ander => ( isa => 'Ttl::And' );
sub BUILD {
my $self = shift;
View
26 lib/Reflex.pm
@@ -53,9 +53,9 @@ Reflex - Class library for flexible, reactive programs.
use Moose;
extends 'Reflex::Base';
use Reflex::Interval;
- use Reflex::Trait::Observed;
+ use Reflex::Trait::Watched qw(watches);
- observes ticker => (
+ watches ticker => (
isa => 'Reflex::Interval',
setup => { interval => 1, auto_repeat => 1 },
);
@@ -103,16 +103,16 @@ warnings, strict, and base instead. Reflex::Base provides emit().
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::Observed (via its exported observes() declarative
-syntax) implicitly watches the object in echoer(), mapping its "pong"
-event to the on_echoer_pong() method.
+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.
package Pinger;
use Moose;
extends 'Reflex::Base';
- use Reflex::Trait::Observed;
+ use Reflex::Trait::Watched;
- observes echoer => (
+ watches echoer => (
isa => 'Echoer',
default => sub { Echoer->new() },
);
@@ -248,7 +248,7 @@ work with them using these adapters.
=item Reflex::POE::Postback - Communicate with POE components expecting
-=item Reflex::POE::Session - Observe events from a POE::Session object.
+=item Reflex::POE::Session - Watch events from a POE::Session object.
=item Reflex::POE::Wheel - Base class for POE::Wheel wrappers.
@@ -307,7 +307,7 @@ process management.
=over 2
-=item Reflex::PID - Observe the exit of a subprocess by its SIGCHLD signal.
+=item Reflex::PID - Watch the exit of a subprocess by its SIGCHLD signal.
=item Reflex::Signal - Generic signal watcher and base class for specific
@@ -328,19 +328,19 @@ it eventually, and you're welcome to help.
Reflex also implements signal/slot style object interaction, through
emit() and watch() methods. These traits were inspired by Smalltalk's
-observable object attributes.
+watchable object attributes.
=over 2
=item Reflex::Trait::EmitsOnChange - Emit an event when an attribute’s value
-=item Reflex::Trait::Observed - Automatically watch Reflex objects.
+=item Reflex::Trait::Watched - Automatically watch Reflex objects.
=back
Reflex::Trait::EmitsOnchange exports a declarative emits() function
-that simplifies use of this trait. Likewise, Reflex::Trait::Observed
-exports observes() to simplify its use.
+that simplifies use of this trait. Likewise, Reflex::Trait::Watched
+exports watches() to simplify its use.
=head1 ASSISTANCE
View
4 lib/Reflex/Client.pm
@@ -10,7 +10,7 @@ use Reflex::Stream;
extends 'Reflex::Connector';
with 'Reflex::Role::Collectible';
-use Reflex::Trait::Observed;
+use Reflex::Trait::Watched qw(watches);
has protocol => (
is => 'rw',
@@ -18,7 +18,7 @@ has protocol => (
default => 'Reflex::Stream',
);
-observes connection => (
+watches connection => (
isa => 'Maybe[Reflex::Stream]',
# Maps $self->put() to $self->connection()->put().
# TODO - Would be nice to have something like this for outbout
View
4 lib/Reflex/PID.pm
@@ -32,7 +32,7 @@ __END__
=head1 NAME
-Reflex::PID - Observe the exit of a subprocess by its SIGCHLD signal.
+Reflex::PID - Watch the exit of a subprocess by its SIGCHLD signal.
=head1 SYNOPSIS
@@ -41,7 +41,7 @@ Reflex::PID - Observe the exit of a subprocess by its SIGCHLD signal.
use Reflex::PID;
- observes pid_watcher => (
+ watches pid_watcher => (
isa => 'Reflex::PID|Undef',
role => 'process',
);
View
2  lib/Reflex/POE/Session.pm
@@ -47,7 +47,7 @@ __END__
=head1 NAME
-Reflex::POE::Session - Observe events from a POE::Session object.
+Reflex::POE::Session - Watch events from a POE::Session object.
=head1 SYNOPSIS
View
8 lib/Reflex/POE/Wheel/Run.pm
@@ -3,7 +3,7 @@ use Moose;
extends 'Reflex::POE::Wheel';
use POE::Wheel::Run;
use Reflex::PID;
-use Reflex::Trait::Observed;
+use Reflex::Trait::Watched qw(watches);
# These are class methods, returning static class data.
# TODO - What's the proper way to do this with Moose?
@@ -84,7 +84,7 @@ sub valid_params {
# Also handle signals.
-observes sigchild_watcher => (
+watches sigchild_watcher => (
isa => 'Maybe[Reflex::PID]',
role => 'sigchld',
);
@@ -123,10 +123,10 @@ Reflex::POE::Wheel::Run - Represent POE::Wheel::Run as a Reflex class.
Unfortunately there isn't a concise, completely executable example for
the synopsis at this time. Please see eg-07-wheel-run.pl and
-eg-08-observer-trait.pl in the distribution's eg directory for longer
+eg-08-watched-trait.pl in the distribution's eg directory for longer
but fully executable ones.
- observes child => (
+ watches child => (
isa => 'Reflex::POE::Wheel::Run|Undef',
);
View
2  lib/Reflex/Role/Reactive.pm
@@ -219,7 +219,7 @@ after BUILD => sub {
foreach my $setup (
grep {
- $_->does('Reflex::Trait::EmitsOnChange') || $_->does('Reflex::Trait::Observed')
+ $_->does('Reflex::Trait::EmitsOnChange') || $_->does('Reflex::Trait::Watched')
}
$self->meta()->get_all_attributes()
) {
View
2  lib/Reflex/Sender.pm
@@ -47,7 +47,7 @@ The original source of an event can be accessed with this method
=head2 get_last_emitter
-The final emitter (the one the observer was explicitly watching) can be
+The final emitter (the one the watcher was explicitly watching) can be
accessed with this method
=head2 get_all_emitters
View
2  lib/Reflex/Trait/EmitsOnChange.pm
@@ -168,7 +168,7 @@ It will be deprecated if default can be made to work instead.
=head1 SEE ALSO
L<Reflex>
-L<Reflex::Trait::Observed>
+L<Reflex::Trait::Watches>
L<Reflex/ACKNOWLEDGEMENTS>
L<Reflex/ASSISTANCE>
View
22 lib/Reflex/Trait/Observed.pm → lib/Reflex/Trait/Watched.pm
@@ -1,10 +1,10 @@
-package Reflex::Trait::Observed;
+package Reflex::Trait::Watched;
use Moose::Role;
use Scalar::Util qw(weaken);
use Reflex::Callbacks qw(cb_role);
use Moose::Exporter;
-Moose::Exporter->setup_import_methods( with_caller => [ qw( observes ) ]);
+Moose::Exporter->setup_import_methods( with_caller => [ qw( watches ) ]);
has setup => (
isa => 'CodeRef|HashRef',
@@ -107,9 +107,9 @@ has setup => (
# },
#);
-### Observed declarative syntax.
+### Watched declarative syntax.
-sub observes {
+sub watches {
my ($caller, $name, %etc) = @_;
my $meta = Class::MOP::class_of($caller);
push @{$etc{traits}}, __PACKAGE__;
@@ -117,8 +117,8 @@ sub observes {
$meta->add_attribute($name, %etc);
}
-package Moose::Meta::Attribute::Custom::Trait::Reflex::Trait::Observed;
-sub register_implementation { 'Reflex::Trait::Observed' }
+package Moose::Meta::Attribute::Custom::Trait::Reflex::Trait::Watched;
+sub register_implementation { 'Reflex::Trait::Watched' }
1;
@@ -126,7 +126,7 @@ __END__
=head1 NAME
-Reflex::Trait::Observed - Automatically watch Reflex objects.
+Reflex::Trait::Watched - Automatically watch Reflex objects.
=head1 SYNOPSIS
@@ -136,13 +136,13 @@ Reflex::Trait::Observed - Automatically watch Reflex objects.
has clock => (
isa => 'Reflex::Interval',
is => 'rw',
- traits => [ 'Reflex::Trait::Observed' ],
+ traits => [ 'Reflex::Trait::Watched' ],
setup => { interval => 1, auto_repeat => 1 },
);
=head1 DESCRIPTION
-Reflex::Trait::Observed modifies a member to automatically observe any
+Reflex::Trait::Watched modifies a member to automatically watch() any
Reflex::Base object stored within it. In the SYNOPSIS, storing a
Reflex::Interval in the clock() attribute allows the owner to watch the
timer's events.
@@ -172,9 +172,9 @@ attribute's name is its default role.
=head1 Declarative Syntax
-Reflex::Trait::Observed exports a declarative observes() function,
+Reflex::Trait::Watched exports a declarative watches() function,
which acts almost identically to Moose's has() but with a couple
-convenient defaults: The Observed trait is added, and the attribute is
+convenient defaults: The Watched trait is added, and the attribute is
given "rw" access by default.
=head1 CAVEATS
View
2  lib/Reflex/UdpPeer.pm
@@ -66,7 +66,7 @@ Use it as a helper.
has port => ( isa => 'Int', is => 'ro' );
- observes peer => (
+ watches peer => (
isa => 'Maybe[Reflex::UdpPeer]',
setup => sub {
my $self = shift;
View
2  t/101-discrete-observer.t → t/101-discrete-watcher.t
@@ -45,8 +45,6 @@ ok( (defined $watcher), "started watcher object" );
#
# The watcher only exists so that watch() may be called. A better
# example would have "tick" handled by one of Reflex::Base's methods.
-# eg-02-observed-new.pl doesn't use a watcher object since no watch()
-# method is called there.
my $countdown = 3;
$watcher->watch(
View
0  t/102-observed-new.t → t/102-watched-new.t
File renamed without changes
View
0  t/103-observer-roles.t → t/103-watcher-roles.t
File renamed without changes
View
10 t/104-emitter-trait.t
@@ -14,12 +14,12 @@ use Test::More tests => 4;
extends 'Reflex::Base';
use Reflex::Interval;
use Reflex::Trait::EmitsOnChange;
- use Reflex::Trait::Observed;
+ use Reflex::Trait::Watched;
use Test::More;
- emits count => ( isa => 'Int', default => 0 );
- observes ticker => ( isa => 'Maybe[Reflex::Interval]' );
+ emits count => ( isa => 'Int', default => 0 );
+ watches ticker => ( isa => 'Maybe[Reflex::Interval]' );
sub BUILD {
my $self = shift;
@@ -44,11 +44,11 @@ use Test::More tests => 4;
package Watcher;
use Moose;
extends 'Reflex::Base';
- use Reflex::Trait::Observed;
+ use Reflex::Trait::Watched;
use Test::More;
- observes counter => ( isa => 'Maybe[Counter]' );
+ watches counter => ( isa => 'Maybe[Counter]' );
sub BUILD {
my $self = shift;
View
10 t/105-setup.t
@@ -6,7 +6,7 @@ use lib qw(../lib);
use Test::More tests => 5;
-# Exercise the new "setup" option for emitters and observers.
+# Exercise the new "setup" option for emitters and watchers.
{
package Counter;
@@ -14,14 +14,14 @@ use Test::More tests => 5;
extends 'Reflex::Base';
use Reflex::Interval;
use Reflex::Trait::EmitsOnChange;
- use Reflex::Trait::Observed;
+ use Reflex::Trait::Watched;
emits count => (
isa => 'Int',
default => 0,
);
- observes ticker => (
+ watches ticker => (
isa => 'Reflex::Interval',
setup => sub {
Reflex::Interval->new( interval => 0.1, auto_repeat => 1 )
@@ -38,11 +38,11 @@ use Test::More tests => 5;
package Watcher;
use Moose;
extends 'Reflex::Base';
- use Reflex::Trait::Observed;
+ use Reflex::Trait::Watched;
use Test::More;
- observes counter => (
+ watches counter => (
isa => 'Counter|Undef',
setup => sub { Counter->new() },
);
View
4 t/125-rcb-promise.t
@@ -26,9 +26,9 @@ use Test::More tests => 3;
extends 'Reflex::Base';
use Reflex::Interval;
use Reflex::Callbacks qw(gather_cb);
- use Reflex::Trait::Observed;
+ use Reflex::Trait::Watched;
- observes ticker => (
+ watches ticker => (
isa => 'Reflex::Interval',
setup => { interval => 1, auto_repeat => 1 },
);
Please sign in to comment.
Something went wrong with that request. Please try again.