Linear web programming in Mason?
Autrijus Tang <[email protected]>
| Newsgroups | gmane.comp.web.mason.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi. Does anyone know if there were any attempts or discussion to bring Mason
toward the "linear web programming model", ala Seaside
(http://beta4.com/seaside2/) or Borges (http://borges.rubyforge.org/)?
This is so one can write components that resembles sequential programs
instead of state machines. A short example follows:
%# Counter.mas:
<& /header &>
<h1>Current Counter: <% $count %></h1>
<&|/button, $m->run_method('Incr') &>++</&>
<&|/button, $m->run_method('Decr') &>--</&>
<%INIT>
my $count = 0;
</%INIT>
<%METHOD Incr>
% $count++;
</%METHOD>
<%METHOD Decr>
% if ($count == 0) {
% # to the user, the next line brings up a new page...
% my $ok = $m->run_comp('Confirm.mas', Text => 'Go negative?');
% # ...after the user clicks "Yes"/"No" we are back here!
% return if !$ok;
% }
% $count--;
</%METHOD>
%# Confirm.mas:
<& /header &>
<p>Please confirm: <b><% $Text %></b></p>
<&|/button, $m->yield(1) &>Yes</&>
<&|/button, $m->yield(0) &>No</&>
<%ARGS>
$Text
</%ARGS>
I understand the subtleties involved (serializing Coro::Cont state for
lexical variables; make continuation-passing-style $m facades; separate
backtrackable methods with nonbacktrackable ones); I merely wish to
check if were prior arts or discussions about this in the Mason/Perl
space, and if this is an obviously insane approach to try with Mason.
Thanks,
/Autrijus/
signature.asc
(application/pgp-signature, 187 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (FreeBSD) iD8DBQFAz4RotLPdNzw1AaARAj7aAJ95u5kVi/BMLCvvovpaRCVsblaqUgCfd8M7 Iun+EFzQ7KhehhMbBO6liNw= =LMWu -----END PGP SIGNATURE-----