|
|
|
|
|
by draegtun
5763 days ago
|
|
Yes scaling continuations based web apps can be a big headache. I think this is why the Seaside developers have been scaling back continuations and making them optional in the framework: http://lists.squeakfoundation.org/pipermail/seaside/2007-Dec... Coroutines are an interesting lighter alternative (though will still suffer from threading & session affinity issues). See coro based libraries/frameworks influenced by Seaside like Continuity (http://continuity.tlt42.org/) & Nagare (http://www.nagare.org/) (which I think uses coros?). Here is a fulling working Continuity example: use strict;
use warnings;
use Continuity;
use HTML::AsSubs;
Continuity->new->loop;
sub main {
my $r = shift;
###########################################
# helpers
my $update_billing_info = sub {
return 1 if eval { $r->param('updated') };
return;
};
my $display_update_billing_info = sub {
$r->print(
form(
input( {type => 'checkbox', name => 'updated'}, 'updated?' ),
br,
input( {type => 'submit'} ),
p( "No. of tries thus far - $_[0]" ),
)->as_HTML
);
};
my $render_checkout_screen = sub {$r->print("Updated after $_[0] submits!")};
###########################################
# business logic
my $count_tries;
while (not $update_billing_info->()) {
$display_update_billing_info->( $count_tries++ );
$r->next;
}
$render_checkout_screen->( $count_tries );
}
|
|