Parent Directory | Revision Log
refactoring to create own Continuity::Widget [0.08] this is incremental step, and it will change along the way...
1 | dpavlin | 96 | package Frey::Web::Coro; |
2 | dpavlin | 69 | |
3 | use Moose::Role; | ||
4 | use Coro::Generator; | ||
5 | |||
6 | has 'cont' => (is => 'rw'); | ||
7 | has 'output' => (is => 'rw'); | ||
8 | has 'input' => (is => 'rw'); | ||
9 | |||
10 | sub process { | ||
11 | my ($self, $input) = @_; | ||
12 | $self->input($input); | ||
13 | $self->{cont} ||= generator { while(1) { $self->main } }; | ||
14 | $self->{cont}->(); | ||
15 | return $self->output; | ||
16 | } | ||
17 | |||
18 | sub next { | ||
19 | my ($self, $output) = @_; | ||
20 | $self->output($output); | ||
21 | yield(); | ||
22 | return $self->input; | ||
23 | } | ||
24 | |||
25 | 1; | ||
26 |
ViewVC Help | |
Powered by ViewVC 1.1.26 |