1 #!/usr/bin/perl
 2 #
 3 # @(#)
 4 #
 5 use strict;
 6 use warnings;
 7 use HTML::FormFu;
 8 use YAML::Syck qw( Load );
 9 use CGI qw(:standard);
10 use HTML::Template;
11 
12 use vars qw ($cgi_query $template $form $formret $TimeFormat);
13 use vars qw ($RstrLdate $RstrLtime);
14 use vars qw ($PRINT_TIDY);
15 
16 my($query, $template, $formret);
17 my($template_out, $CGI_query);
18 
19 #
20 # Note: When calling "new CGI" the variables (as passed by apache) will fill in the
21 #           query and each variable can be accessed via: $form->param_value('variable_name_in_form')
22 $CGI_query = new CGI;
23 print $CGI_query->header();
24     #
25     # open the HTML template
26     $form = HTML::FormFu->new;
27     $form->load_config_file('/opt/http/forms/simple.yml');
28     $form->action("/cgi-bin/simple_get.cgi");
29     $form->method("post");
30     $form->indicator("textvar");
31     $form->query( $CGI_query ) ;
32     $form->process();
33 
34     $template = HTML::Template->new(filename => '/opt/http/templates/simple.shtml');
35     #
36     # fill in some parameters in the template
37     if ( $form->submitted ) {
38         `/bin/echo "proc: submittted" >>/tmp/http.log`;
39         #
40         $template->param( form => $form->param_value('textvar') );
41         $template_out = $template->output;
42         print $template_out . "\n";
43     } else {
44         `/bin/echo "proc: Not-submittted" >>/tmp/http.log`;
45         $template->param( form => $form );
46         $template_out = $template->output;
47         print $template_out . "\n";
48     }