asha_mail has asked for the wisdom of the Perl Monks concerning the following question:
I have one perl script file with following code
main.pl
#!/usr/bin/perl use strict; use warnings; use CGI qw(:all); #Create a new CGI object my $cgi = new CGI; print "Content-type:text/html\n\n"; print <<EndOfHTML; <center><<strong class="highlight"> SOFTWARE DIAGNOSTIC </strong>></ce +nter><head><title>Generating Self-Referential URLs</title></head> <body> <br><br> <center> <a href="progress_bar.pl"><img src="/images/diagnostics-icon.jpg" alt= +"SoftDiagno" width="800" height="450"></a> </center> </body> EndOfHTML
Progress_bar.pl
#!/usr/bin/perl use Tk; use Tk::ProgressBar; use strict; use CGI qw(:all); my $percent_done = 0; my $cgi = new CGI; print "Content-Type: text/html \n\n"; my $mw = MainWindow->new; my $text = "Percentage to date: $percent_done"; $mw->title('Progress Bar'); my $message = $mw->Message(-textvariable => \$text, -width => 130, -border => 2); my $progress = $mw->ProgressBar( -width => 30, -from => 0, -to => 100, -blocks => 50, -colors => [0, 'green', 50, 'yellow' , 80, 'red'], -variable => \$percent_done )->pack(-fill => 'x'); my $exit = $mw->Button(-text => 'Exit', -command => [$mw => 'destroy']); my $get = $mw->Button(-text => 'Press to start!', -command => \&start); $get->pack; $message->pack; $exit->pack; MainLoop; sub start { for ($percent_done=0; $percent_done <= 100; $percent_done +=20) { $text = "Loading: $percent_done%"; $mw->update; sleep 1; } $text = 'Done!'; $mw->update; }
When Progress_Bar.pl file is called its showing blank page in browser.How to display the output of Progress_Bar.pl in main.pl when the image is clicked?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Display perl code output in CGI script
by Anonymous Monk on Dec 21, 2011 at 07:56 UTC | |
by Anonymous Monk on Dec 21, 2011 at 12:48 UTC | |
by asha_mail (Novice) on Dec 21, 2011 at 08:56 UTC | |
by choroba (Cardinal) on Dec 21, 2011 at 09:01 UTC | |
by Anonymous Monk on Dec 21, 2011 at 09:07 UTC | |
by asha_mail (Novice) on Dec 21, 2011 at 09:32 UTC | |
by marto (Cardinal) on Dec 21, 2011 at 09:57 UTC | |
by Anonymous Monk on Dec 21, 2011 at 09:55 UTC | |
|