Line | |
---|
1 | use strict; |
---|
2 | use warnings; |
---|
3 | |
---|
4 | use Text::FormBuilder; |
---|
5 | use CGI; |
---|
6 | |
---|
7 | my $q = CGI->new; |
---|
8 | |
---|
9 | my $src_file = get_src_file($q->param('form_id')); |
---|
10 | |
---|
11 | my $parser = Text::FormBuilder->new; |
---|
12 | my $form = $parser->parse($src_file)->build(method => 'POST', params => $q)->form; |
---|
13 | |
---|
14 | if ($form->submitted && $form->validate) { |
---|
15 | # TODO: |
---|
16 | # call storage function |
---|
17 | my $plugin = 'DumpParams'; |
---|
18 | eval "use $plugin;"; |
---|
19 | |
---|
20 | if ($plugin->process($q)) { |
---|
21 | # show thank you page |
---|
22 | #print $q->header('text/plain'); |
---|
23 | #print "Thank you for your input!\n" |
---|
24 | } else { |
---|
25 | # there was an error processing the results |
---|
26 | } |
---|
27 | |
---|
28 | } else { |
---|
29 | print $q->header; |
---|
30 | print $form->render; |
---|
31 | } |
---|
32 | |
---|
33 | sub get_src_file { |
---|
34 | my $form_id = shift; |
---|
35 | return "$form_id.txt"; |
---|
36 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.