Code review:
1: package Test_code;
2: use base 'CGI::Application';
3: use HTML::Template;
You don't need that. C::A calls it by default and you don't
use it in this module.
4: use Data::FormValidator;
You don't need that. I assume you'll use it later, but comment
it out until you're ready to test that feature.
5: use DBI;
6: use DBI qw(:sql_types);
You only need to use DBI once. Line 6 is enough. Line 5 is
fine for now.
7: use strict;
use warnings;
44: # Path to use for Templates....
45: #$self->tmpl_path('./'); # ie the same directory as this script.
46: $self->tmpl_path("c:\\xitami\\webpages\\TestBed\\");
Use perl's file separator unless you are certain you need
a platform specific solution. Use single quotes when possible.
$self->tmpl_path( 'c:/xitami/webpages/TestBed/' );
78: sub mainmenu
79: {
80: my $self = shift;
81: my $dbh = $self->param('mydbh');
82:
83: # Get the CGI query object so that you can use the CGI.pm modules.
84: my $q = $self->query();
Don't need that. We aren't using $q in this method.
86: # Setup the template to use for the output.
87: my $template = $self->load_tmpl('test2.tmpl.htm');
See why we don't need to use HTML::Template? It's built-in.
89: # call param to fill in the loop with the loop data by reference.
90: $template->param(db_loop => $self>GetOfficers());
$template->param( db_loop => $self->GetOfficers() );
99: sub insertproject
100: {
101: my $self = shift; # get the passed parameters.
102: my $q = $self->query(); # get acopy of the CGI object.
103: my $dbh = $self->param('mydbh'); # get the database handle.
Don't need that. We aren't using $dbh in this method.
104:
105: ## Construct the SQL Statement
106: # Get the values from the form.
107: # my $HTML_OCLRef = $q->param("HTML_OCLRef");
108: # my $HTML_ProjectID = $q->param("HTML_ProjectID");
109: my $HTML_Priority=$q->param("HTML_Priority")||undef;
110: my $HTML_Status=$q->param("HTML_Status");
111: my $HTML_Officer=$q->param("HTML_Officer")||undef;
112:
113:
114: # Setup the template to use for the output.
115: my $template = $self->load_tmpl('test2.tmpl.htm');
116: #set up the data to give to the HTML template....
117: $template->param(HTML_Priority => $HTML_Priority);
118: $template->param(HTML_Status => $HTML_Status);
119: $template->param(HTML_Officer => $HTML_Officer);
120:
121: # Output the template...
122: $template->output;
Associate the query with the template instead.
sub insertproject {
my $self = shift;
my $template = $self->load_tmpl(
'test2.tmpl.htm',
associate => $self->query,
die_on_bad_params => 0,
);
return $template->output;
}
HTH,
Charles K. Clarkson
--
Mobile Homes Specialist
254 968-8328
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>