/[Frey]/trunk/lib/Frey/Web/Coro.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/lib/Frey/Web/Coro.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 96 - (show annotations)
Fri Jul 11 12:47:50 2008 UTC (15 years, 9 months ago) by dpavlin
File size: 435 byte(s)
refactoring to create own Continuity::Widget [0.08]

this is incremental step, and it will change along the way...
1 package Frey::Web::Coro;
2
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