logo       

RE: Re: Help on possible CGI::Application::Plugin::HTML :Table: msg#00063

Subject: RE: Re: Help on possible CGI::Application::Plugin::HTML :Table
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:mark@xxxxxxxxxxxxxxx] 
Sent: 16 August 2005 03:23
To: cgiapp@xxxxxxxxxxxxxxxxx
Subject: [cgiapp] Re: Help on possible CGI::Application::Plugin::HTML:Table

On 2005-08-15, Sean Davis <sdavis2@xxxxxxxxxxxx> wrote:
> On 8/15/05 11:55 AM, "Johan Bosman (EDS)" <johanbo@xxxxxxxxxxxxxx> 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/cgiapp@xxxxxxxxxxxxxxxxx/
              http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: cgiapp-unsubscribe@xxxxxxxxxxxxxxxxx
For additional commands, e-mail: cgiapp-help@xxxxxxxxxxxxxxxxx
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
linux.arklinux....    user-groups.lin...    kde.usability/2...    ietf.ipp/2002-0...    mail.spam.spamc...    os.netbsd.devel...    audio.cd-record...    text.unicode.de...    php.documentati...    games.fps.halfl...    window-managers...    suse.oracle.gen...    bug-tracking.gn...    video.dvdrip.us...    xfree86.cvs/200...    java.netbeans.m...    network.argus/2...    culture.sf.kill...    debian.ports.al...    freebsd.questio...    qplus.devel/200...    handhelds.palm....   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe