b0VIM 7.0pGs"&awwaiidtalon.thelackthereof.org~awwaiid/tlt/projects/perl/tmp/statetest.pl 3210#"! Utp}ad,4}a`3j; q F ! L K 4 )     n h e d E ' & q F m > < ;   m`qq/% t_A/+* {iYG75431} $child->exec; $requ} $child->exec; $request->} $child->exec; $request->next; $c} $child-} $child->exec;} $child->exec; $requ}} $child->exec; $request->next; $child->exec; $request->next; $child->exec; my $child = CounterWidget->new(request => $request); my ($request) = @_;sub main {Continuity->new( port => 8080 )->loop;use Continuity;package main;# } # $self->yield; # print "... last of a.\n"; # $self->yield(7); # print "... more in a ...\n"; # ($p) = $self->yield(42); # print "In 'a' ($p - $thing)\n"; # my $counter = 0; # my ($self, $request) = @_;# sub main {} } } });

The Answer to Life, The Universe, and Everything

$self->request->print(q{ if($counter == 42) { $counter-- if $action eq '--'; $counter++ if $action eq '++'; } $action = '' if $choice eq 'No'; my $choice = $self->prompt("Do you really want to GO NEGATIVE?", "Yes", "No"); if($action eq '--' && $counter == 0) { print STDERR "Got '$action' back from the user.\n"; my $action = $self->prompt("Count: $counter", "++", "--"); print STDERR "Displaying current count and waiting for instructions.\n"; while(1) { # After we're done with that we enter a loop. Forever. my $counter = 0; # This keeps track of the number we're currently on my ($self) = @_;sub main {# Main is invoked when we get a new session} return $option || $self->prompt($msg, @ops); my $option = $self->request->param("$id-option"); $self->yield; # Subtle! Halt, wait for next request, and grab the 'option' param } $self->request->print(qq{$ops[$i] }); for(my $i = 0; $i < scalar @ops; $i++) { $self->request->print("$msg
"); my $id = $self->uuid; my ($self, $msg, @ops) = @_;sub prompt {# Ask a question and keep asking until they answer. General purpose prompt.has 'output' => (is => 'rw');has 'request' => (is => 'rw');); } $d->to_string($d->create); my $d = Data::UUID->new; default => sub { isa => 'Str', is => 'ro', has 'uuid' => (use Data::UUID;extends 'Widget';use Moose;package CounterWidget;sub main { die "You should have overriden this!\n" }} return wantarray ? @{$self->results} : $self->results->[0]; #$self->parent_state(undef); # Kill circular reference! print STDERR "Back from child.\n"; $parent->transfer($self->{state}); print STDERR "Transferring to child.\n"; $self->parent_state($parent); my $parent = new Coro::State; $self->params( \@params ); my ($self, @params) = @_;sub exec {} return @{$self->params}; print STDERR "back from transfer.\n"; $self->state->transfer($self->parent_state); print STDERR "About to transfer...\n"; $self->results( [@results] ); my ($self, @results) = @_;sub yield {}); } $self->main(@{$self->params}) new Coro::State sub { my $self = shift;has 'state' => (is => 'rw', default => sub {has 'params' => (is => 'rw');has 'parent_state' => (is => 'rw');has 'results' => (is => 'rw');use Moose;use Coro::State;package Widget;#!/usr/bin/perl