Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

file 50 lines (39 sloc) 0.821 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
#!/usr/bin/env perl

use warnings;
use strict;
use lib qw(../lib);

# Exercise Reflex::POE::Postback, for passing postbacks into POE space.

{
package App;

use Moose;
extends 'Reflex::Base';
use Reflex::POE::Postback;
use PoCoPostback;

has component => (
isa => 'Object|Undef',
is => 'rw',
);

sub BUILD {
my $self = shift;
$self->component( PoCoPostback->new() );

$self->component->request(
Reflex::POE::Postback->new(
$self, "on_component_result", { cookie => 123 }
),
);
}

sub on_component_result {
my ($self, $args) = @_;
print(
"Got component response:\n",
" postback context: $args->{context}{cookie}\n",
" call-back result: $args->{response}[0]\n",
);

# Ok, we're done.
$self->component(undef);
}
}

# Main.

my $app = App->new();
$app->run_all();
exit;
Something went wrong with that request. Please try again.