Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Convert to using heredoc

Additionally, refactor variable usage
  • Loading branch information...
commit 869d8ea8a359a003fb0aeeec6473c4a042359011 1 parent 20890f4
@genehack authored
Showing with 31 additions and 29 deletions.
  1. +31 −29 www/cgi-bin/presentor_start.pl
View
60 www/cgi-bin/presentor_start.pl
@@ -1,37 +1,39 @@
#!/usr/bin/perl
+
+use CGI qw/:standard/;
use DBI;
use Net::Address::IP::Local;
use URL::Encode qw/url_encode/;
-
-use CGI qw/:standard/;
-
-print header;
-
my $number = int(rand 1000) + 100;
+my $ip = Net::Address::IP::Local->public_ipv4;
-my $password = param("PASSWORD");
-my $host_alias = param("HOST_ALIAS");
-
-print "<HTML><head>";
-print "<meta http-equiv=\"refresh\" content=\"30; url=http://" . Net::Address::IP::Local->public_ipv4 . "/cgi-bin/vnc_results.pl?SOURCE=$number\">";
-print "<link rel=\"stylesheet\" href=\"/Barcode/barcode.css\" type=\"text/css\">";
-print "<script src=\"/Barcode/barcode.js\" type=\"text/javascript\"></script>";
+my $password = url_encode(param("PASSWORD"));
+my $host_alias = url_encode(param("HOST_ALIAS"));
-print "</head><BODY onload=\"go();\">";
-print "Please wait... <BR>";
-print "Number : $number <BR>";
-print "<div class=\"barcode128h\" id=\"barcode\"></div>";
-print "<BR>";
-print "<script type=\"text/javascript\">";
-print " var strBarcodeHTML = code128('Z' + $number);"; # Darn u javascript
-print " document.getElementById(\"barcode\").innerHTML = strBarcodeHTML;";
-print "function go(){";
-print "var image = new Image();";
-print "image.onload = function() {";
-print "window.location=\"http://" . Net::Address::IP::Local->public_ipv4 . "/cgi-bin/vnc_results.pl?SOURCE=$number\";";
-print "};";
-print " image.src='/cgi-bin/wait_for_vnc.pl?SOURCE=$number&P=" . url_encode($password) . "&HA=" . url_encode($host_alias) . "';";
-
-print "}\n";
-print "</script></body></html>";
+print header;
+print <<EOHTML;
+<html>
+ <head>
+ <meta http-equiv="refresh" content="30; url=http://$ip/cgi-bin/vnc_results.pl?SOURCE=$number" />
+ <link rel="stylesheet" href="/Barcode/barcode.css" type="text/css">
+ <script src="/Barcode/barcode.js" type="text/javascript"></script>
+ </head>
+ <body onload="go();">
+ <p>Please wait...<br/> Number: $number </p>
+ <div class="barcode128h" id="barcode"></div>
+ <br/>
+ <script type="text/javascript">
+ var strBarcodeHTML = code128('Z' + $number);
+ document.getElementById("barcode").innerHTML = strBarcodeHTML;
+ function go(){
+ var image = new Image();
+ image.onload = function() {
+ window.location="http://$ip/cgi-bin/vnc_results.pl?SOURCE=$number\";
+ };
+ image.src='/cgi-bin/wait_for_vnc.pl?SOURCE=$number&P=$password&HA=$host_alias';
+ }
+ </script>
+ </body>
+</html>
+EOHTML
Please sign in to comment.
Something went wrong with that request. Please try again.