Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 29 lines (22 sloc) 0.425 kb
f4f25e89 »
2010-04-07 Hide some of the promise awkwardness in a Promise watcher.
1 package ReflexPromise;
2
3 use Moose;
1f5ed273 »
2010-06-27 Rename Reflex::Role::Object to Reflex::Role::Reactive; Reflex::Object…
4 extends 'Reflex::Base';
f4f25e89 »
2010-04-07 Hide some of the promise awkwardness in a Promise watcher.
5
6 use Reflex::Callbacks qw(cb_promise);
7
8 has object => (
1f5ed273 »
2010-06-27 Rename Reflex::Role::Object to Reflex::Role::Reactive; Reflex::Object…
9 isa => 'Reflex::Base',
f4f25e89 »
2010-04-07 Hide some of the promise awkwardness in a Promise watcher.
10 is => 'ro',
11 );
12
13 has promise => (
14 isa => 'ScalarRef',
15 is => 'ro',
16 default => sub { return \my $x },
17 );
18
19 sub BUILD {
20 my $self = shift;
5f9458c0 »
2010-06-15 Rename observe() to watch(). Rename wait() to next().
21 $self->watch($self->object(), cb_promise($self->promise()));
f4f25e89 »
2010-04-07 Hide some of the promise awkwardness in a Promise watcher.
22 }
23
5f9458c0 »
2010-06-15 Rename observe() to watch(). Rename wait() to next().
24 sub next {
f4f25e89 »
2010-04-07 Hide some of the promise awkwardness in a Promise watcher.
25 my $self = shift;
5f9458c0 »
2010-06-15 Rename observe() to watch(). Rename wait() to next().
26 return ${$self->promise()}->next();
f4f25e89 »
2010-04-07 Hide some of the promise awkwardness in a Promise watcher.
27 }
28
29 1;
Something went wrong with that request. Please try again.