Thanks for the feedback. How should I use the HTML::Table module in a
CGI::Application? It seems that I am doing something wrong. In the following
code I call a function (_query ) from Query (run mode1) that creates the
object $table1 . The problem is that this object is only visible from the
_query function, and the next run mode (Table_Main) can't see it. I tried to
change the scope of $table1, but it is still not working. I need to call
_query from Query, other wise the progress bar doesn't work.
Sorry for all the code)
package SI;
use base 'CGI::Application';
use HTML::Template;
use HTML::Table;
sub setup {
my $self = shift;
$self->run_modes(
'mode_1' => 'Query',
'mode_2' => 'Table_Main',
'mode_3' => 'End',
);
$self->start_mode('mode_1');
$self->mode_param('rm');
$self->tmpl_path('./');
}
sub Query {
my $self = shift;
my $query = $self->query;
$self->header_type('none');
print $query->header(-expires => '-1d');
my $template = $self->load_tmpl('probar.html');
print $template->output;
&_query;
&_progress_callback;
}
sub _query {
my $self = shift;
my $table1 =
HTML::Table->new(-rows=>0,-cols=>0,-align=>'left',-border=>1,-bordercolor=>'
#C0C0C0',-spacing=>0,-style=>'border-collapse: collapse; font-size:8pt;
font-variant:normal; font-family:Tahoma',);
#some code to get @record_row
$table1->addRow(@record_row);
$table1->sort(0, 'ALPHA', 'ASC',1);
$table1->getTable;
}
sub Table_Main {
my $self = shift;
my $template = $self->load_tmpl('cat.html');
$template->param
(
title => "main",
table => "$table1",
);
my $html_output = $template->output;
return $html_output;
}
sub _progress_callback {
print "<script language='JavaScript'>submitForm(this.form)</script>\n";
}
-----Original Message-----
From: Mark Stosberg [mailto:suppressed
Sent: 16 August 2005 03:23
To: suppressed
Subject: [cgiapp] Re: Help on possible CGI::Application::Plugin::HTML:Table
On 2005-08-15, Sean Davis <suppressed> wrote:
> On 8/15/05 11:55 AM, "Johan Bosman (EDS)" <suppressed> wrote:
>
>> I am using CGI::Application in a project that also requires
>> HTML:Table and it looks like I would have to write a plug-in to
>> accomplish this. I am not a regular Perl user and am not to sure what
>> is involved in developing plug-ins for C::A. Can someone more
>> experienced maybe point me in the right direction?
>>
> You don't have to write a plugin to use it. You can simply use it as
> needed in your module. If you wanted to develop a plugin, it might be
> useful for others, but doing so certainly isn't a necessity to being
> able to use a module within CGI::Application.
That's right. Using another perl module in CGI::Application should never be
any harder than using it in a plain CGI script.
However, sometimes with plug-ins the interface can made even easier to use.
HTML::Table is not an object that looks like it would benefit by creating a
plugin for it.
Mark
--
http://mark.stosberg.com/
---------------------------------------------------------------------
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.