The Perl+Continuity solution also uses "first, second & third" style and does it nicely without sessions and adheres to challenge by being an established library: http://arclanguage.org/item?id=805
Here is a version using the HTML::AsSubs module:
use Continuity;
use HTML::AsSubs;
Continuity->new->loop; # This starts the webserver
sub main {
my $request = shift;
my $p = 'foo';
$request->print( aform( $p )->as_HTML );
my $foo = $request->next->param( $p );
$request->print( w_link()->as_HTML );
$request->next->print( "You said: $foo" );
}
sub aform {
form(
input( { type => 'text', name => $_[0] } ),
input( { type => 'submit'} )
);
}
sub w_link { a( { href => '.' }, 'Click Here' ) }
Here is a version using the HTML::AsSubs module: