Samy_rio has asked for the wisdom of the Perl Monks concerning the following question:
Is it possible to use Tk coding in cgi?
While running Tk alone, its working properly, but when i am using in cgi, I am not getting the output.
#!C:\perl\bin\perl use strict; use CGI; use DBI; use Tk; use Tk::HList; my $q = new CGI; print $q->header("text/html"), $q->start_html(-title=>"test"); print $q->p("hi"); my $dbh = DBI->connect("DBI:mysql:velusamy", {PrintError =>0, RaiseErr +or =>0}) ; #automatic error checking my $data = qq(select empno, name from testing order by name); my $sth = $dbh->prepare($data); $sth->execute; my ($sno, $name); my $mw = MainWindow->new; my $hlist = $mw->HList(-columns => 2, -header => 1) ->pack(-expand => 1, -fill => 'both'); $hlist->headerCreate(0, -text => "Emp-No"); $hlist->headerCreate(1, -text => "Emp-Name"); while ( ( $sno, $name) = $sth->fetchrow_array ) { $hlist->add($sno); $hlist->itemCreate($sno, 0, -text => uc($sno)); $hlist->itemCreate($sno, 1, -text => uc($name)); } MainLoop; $dbh->disconnect; print $q->end_html;
Give your suggestions.
Regards,
Samy
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: TK in CGI
by davido (Cardinal) on Jun 25, 2005 at 06:49 UTC | |
by Samy_rio (Vicar) on Jun 25, 2005 at 06:57 UTC | |
|
Re: TK in CGI
by zentara (Cardinal) on Jun 25, 2005 at 10:36 UTC | |
by davido (Cardinal) on Jun 25, 2005 at 15:26 UTC | |
by zentara (Cardinal) on Jun 26, 2005 at 10:53 UTC | |
|
users have the last word
by chanio (Priest) on Jun 25, 2005 at 18:03 UTC |