/[Frey]/trunk/lib/Frey/Web/Field.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/Field.pm

Parent Directory Parent Directory | Revision Log Revision Log


Revision 146 - (show annotations)
Wed Jul 16 21:20:14 2008 UTC (15 years, 9 months ago) by dpavlin
File size: 756 byte(s)
move comment to pod
1 package Frey::Web::Field;
2
3 use Moose::Role;
4 use Coro::Generator;
5 use Data::UUID;
6
7 has 'cont' => (is => 'rw');
8 has 'output' => (is => 'rw');
9 has 'input' => (is => 'rw');
10
11 has 'uuid' => (
12 is => 'ro',
13 isa => 'Str',
14 default => sub { Data::UUID->new->create_str }
15 );
16
17 =head2 field_name
18
19 Given a name generate a unique field ID
20
21 my $unique_id = $o->field_name( $name );
22
23 =cut
24
25 sub field_name {
26 my ($self, $name) = @_;
27 return $self->uuid . '-' . $name;
28 }
29
30 sub process {
31 my ($self, $input) = @_;
32 $self->input($input);
33 $self->{cont} ||= generator { while(1) { $self->main } };
34 $self->{cont}->();
35 return $self->output;
36 }
37
38 sub next {
39 my ($self, $output) = @_;
40 $self->output($output);
41 yield();
42 return $self->input;
43 }
44
45 1;
46

  ViewVC Help
Powered by ViewVC 1.1.26