I am new to the CGI and CGI-App world and, of course, have some code that is
confusing me. Here is the code for OligoMap.pm (below). If I use runmode
mode3, I go to return_probe_details. If I use runmode=mode1, I go to
subroutine query_probe which uses CGI.pm to generate HTML to insert into an
HTML Template (excerpt below). If I go to return_probe_details, which does
not use HTML::Template, the HTML is generated without issue. If, on the
other hand, I use the HTML::Template in query_probe, I get the following
error message (server log). Can anyone help me out with what I am missing?
Thanks,
Sean
HTML::Template : Attempt to set nonexistent parameter '<input
type="checkbox" name="
fetchwhat" value="blat hits" />blat hits' - this parameter name doesn't
match any de
clarations in the template file : (die_on_bad_params => 1) at
/Library/WebServer/CGI
-Executables/OligoMap.pm line 81
Issuing rollback() for database handle being DESTROY'd without explicit
disconnect()
.
Issuing rollback() for database handle being DESTROY'd without explicit
disconnect()
.
[Thu Jun 24 16:25:35 2004] [error] [client 127.0.0.1] Premature end of
script header
s: /Library/WebServer/CGI-Executables/oligo.pl
package OligoMap;
use strict;
use base 'CGI::Application';
use DBI;
use HTML::Template;
####################################################
# database setup
# hardcoded access stuff
####################################################
REMOVED for security reasons....
sub setup {
my $self=shift;
$self->start_mode('mode1');
$self->mode_param('rm');
$self->run_modes(
'mode1' => 'query_probe',
'mode3' => 'return_probe_details',
);
$self->param('probedbh' => DBI->connect($dsnprobe,
$probeuser,
$probepass,
{
RaiseError => 1,
PrintError => 0,
AutoCommit => 0
}
)) ||
die "Database connection not made: $DBI::errstr";
$self->param('ensdbh' => DBI->connect($dsnens,
$ensuser,
'',
{
RaiseError => 1,
PrintError => 0,
AutoCommit => 0
}
)) ||
die "Database connection not made: $DBI::errstr";
}
sub teardown {
my $self = shift;
#Disconnect databases;
$self->param('ensdbh')->disconnect();
$self->param('probedbh')->disconnect();
}
sub query_probe {
my $self = shift;
# Get CGI query object;
my $q = $self->query();
my $template = $self->load_tmpl('test.html');
$template->param('HELLO' => 'hello');
$template->param('STARTFORM' => $q->start_form());
$template->param('tbname' => $q->textfield(-name => 'name'));
$template->param('fetchwhat' => $q->checkbox_group(
-name=>'fetchwhat',
-values=>['Database Cross-references',
'Blat Hits',
'Ensembl Mapping Information',],
-defaults=>['Database Cross-references'],
-linebreak=>0));
$template->param('b_submit' => $q->submit());
$template->param('ENDFORM' => $q->end_form);
$template->param('HIDDEN' => $q->hidden(-name => 'rm', -value =>
'mode3'));
return $template->output;
}
sub return_probe_details {
my $self = shift;
# Get Query Object
my $q = $self->query();
my $output = '';
$output .= $q->start_html(-title => 'Query Human Oligo Probe',
-BGCOLOR => 'aquamarine');
$output .= $q->startform();
$output .= 'hello';
$output .= '<p>';
$output .= $q->checkbox_group(
-name=>'fetchwhat',
-values=>['Database Cross-references',
'Blat Hits',
'Ensembl Mapping Information',],
-defaults=>['Database Cross-references'],
-linebreak=>0);
$output .= $q->end_form;
$output .= $q->end_html();
return $output;
}
1;
HTML TEMPLATE:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Query Qiagen Oligo Probes</title>
</head>
<body bgcolor="aquamarine">
<h1>Query Qiagen Oligo Probes</h1>
<!-- TMPL_VAR NAME="HELLO" -->
<!-- TMPL_VAR NAME="STARTFORM" -->
<!-- TMPL_VAR NAME="HIDDEN" -->
<!-- TMPL_VAR NAME="tbname" -->
<!-- TMPL_VAR NAME="fetchwhat" -->
<!-- TMPL_VAR NAME="b_submit" -->
<!-- TMPL_VAR NAME="ENDFORM" -->
<hr>
</body>
</html>
On 6/24/04 3:18 PM, "William McKee" <suppressed> wrote:
> On Thu, Jun 24, 2004 at 01:42:35PM -0400, Sean Davis wrote:
>>> From where is the tagset <div></div> coming? It isn't a problem here, of
>> course, but if I try to use this with HTML::template, it is causing
>> problems. Any ideas?
>
> Hi Sean,
>
> That's a good question. I don't understand what problems you forsee with
> HTML::Template since you are generating all of your html output rather
> than using H::T to parse a template file. Perhaps if you could show the
> complete example, we could be a further assistance.
>
> Also, you might want to try asking it on the CGI-Application mailing
> list as lots of folks there use HTML::Template (I'm not one of them so
> don't know why a div would give it problems).
>
> Since you're using CGI.pm to generate all of your html, you might want
> to check the docs for it.
>
>
> HTH,
> William
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/suppressed/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.