El Módulo Continuity: CGIs con Estado

Véase Continuity

pp2@nereida:~/src/perl/Continuity/examples$ cat -n addtwo.pl
 1  #!/usr/bin/perl
 2
 3  use strict;
 4  use lib '../lib';
 5  use Continuity;
 6
 7  Continuity->new->loop;
 8
 9  sub main {
10    my $request = shift;
11
12    $request->print(qq{
13      <form>
14        Enter first number:
15        <input type=text name=num><input type=submit>
16      </form>
17    });
18    $request->next;
19    my $num1 = $request->param('num');
20
21    $request->print(qq{
22      <form>
23        Enter second number:
24        <input type=text name=num><input type=submit>
25      </form>
26    });
27    my $num2 = $request->next->param('num');
28
29    my $sum = $num1 + $num2;
30    $request->print(qq{
31      <h2>The sum of $num1 and $num2 is $sum!</h2>
32    });
33  }

pp2@nereida:~/src/perl/Continuity/examples$ addtwo.pl
Please contact me at: http://nereida.deioc.ull.es:53009/
Warning: Attempt to remove nonexistent passive grab

Casiano Rodríguez León
Licencia de Creative Commons
Programación Distribuida y Mejora del Rendimiento
por Casiano Rodríguez León is licensed under a Creative Commons Reconocimiento 3.0 Unported License.

Permissions beyond the scope of this license may be available at http://campusvirtual.ull.es/ocw/course/view.php?id=44.
2012-06-19