Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 51 lines (39 sloc) 0.821 kB
bf57dfb @rcaputo Support POE::Components that wish to be given postbacks.
authored
1 #!/usr/bin/env perl
2
b811c71 @rcaputo Give the fourth sortie a new name. It's 53% done now!
authored
3 use warnings;
4 use strict;
9e56da9 @rcaputo Add the examples to the distribution, and ensure they run in their ne…
authored
5 use lib qw(../lib);
b811c71 @rcaputo Give the fourth sortie a new name. It's 53% done now!
authored
6
7 # Exercise Reflex::POE::Postback, for passing postbacks into POE space.
bf57dfb @rcaputo Support POE::Components that wish to be given postbacks.
authored
8
9 {
10 package App;
11
12 use Moose;
1f5ed27 @rcaputo Rename Reflex::Role::Object to Reflex::Role::Reactive; Reflex::Object…
authored
13 extends 'Reflex::Base';
b811c71 @rcaputo Give the fourth sortie a new name. It's 53% done now!
authored
14 use Reflex::POE::Postback;
bf57dfb @rcaputo Support POE::Components that wish to be given postbacks.
authored
15 use PoCoPostback;
16
17 has component => (
18 isa => 'Object|Undef',
19 is => 'rw',
20 );
21
22 sub BUILD {
23 my $self = shift;
24 $self->component( PoCoPostback->new() );
25
26 $self->component->request(
b811c71 @rcaputo Give the fourth sortie a new name. It's 53% done now!
authored
27 Reflex::POE::Postback->new(
28 $self, "on_component_result", { cookie => 123 }
29 ),
bf57dfb @rcaputo Support POE::Components that wish to be given postbacks.
authored
30 );
31 }
32
33 sub on_component_result {
34 my ($self, $args) = @_;
35 print(
36 "Got component response:\n",
b811c71 @rcaputo Give the fourth sortie a new name. It's 53% done now!
authored
37 " postback context: $args->{context}{cookie}\n",
38 " call-back result: $args->{response}[0]\n",
bf57dfb @rcaputo Support POE::Components that wish to be given postbacks.
authored
39 );
40
41 # Ok, we're done.
42 $self->component(undef);
43 }
44 }
45
b811c71 @rcaputo Give the fourth sortie a new name. It's 53% done now!
authored
46 # Main.
47
bf57dfb @rcaputo Support POE::Components that wish to be given postbacks.
authored
48 my $app = App->new();
49 $app->run_all();
50 exit;
Something went wrong with that request. Please try again.