NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
what he said (Score:1)
Re:what he said (Score:0)
I actually tried installing Jifty last night because I realized it might be more what I had in mind (continuations, Mason...), but I aborted the install after about a half hour of exciting CPAN action. (Maybe I should try Catalyst I guess, but it's never really felt right to me..)
Then I ended up doing just what you mentioned, using Mason as a standalone script. It wasn't very elegant, though. Unfortunately I didn't bring my laptop today so I can't copy what I have, but from memory it was something like this (based on the addtwo.pl example in Continuity):
my $server = Continuity->new(port => 65432);
$server->run; # (or whatever it is)
sub main {
my $request = shift;
my $outbuf = '';
my $interp = HTML::Mason::Interp->new(
comp_root => '...',
data_root => '...',
out_method => \$outbuf, # something like that
);
$interp->exec('/one.html');
$request->print($outbuf);
$request->next;
my $num1 = $request->param('num');
$outbuf = '';
$interp->exec('/two.html');
$request->print($outbuf);
$request->next;
my $num2 = $request->param('num');
$outbuf = '';
$interp->exec('/sum.html', num1 => $num1, num2 => $num2, sum => $num1 + $num2);
$request->print($outbuf);
}
And there the components 'comp/num1.html' etc. are like:
Enter first number:
<input type=text name=num><input type=submit>
and
<h2>The sum of <% $num1 %> and <% $num2 %> is <% $sum %>!</h2>
<%args>
$num1 => 0
$num2 => 0
$sum => 0
</%args>
and 'autohandler' is like:
<html><body><form>
% $m->call_next();
</form></body></html>
So I guess whatever I did would basically wrap around this tedious incantation:
$interp->exec('/one.html');
$request->print($outbuf);
$request->next;
I guess it's not even a matter of subclassing a mapper/adapter of Continuity or whatever, just making an "exec + print" method on the application side.
Reply to This
Parent
Re: (Score:1)
sub main {
my $request = shift;
my $app = App->new(request => $request);
$app->run;
}
package App.pm;
#
sub run {
my $self = shift;
$self->display('/one.html');
my $num1 = $self->param('num