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?


In reply to Display perl code output in CGI script by asha_mail

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.