469,362 Members | 2,548 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,362 developers. It's quick & easy.

HTML Page Refresh doesn't work in my PERL web page

I have several web pages that are perl files with .pl extensions. Inside these I have HTML code for the web page display. I am trying to have a certain page refresh every five minutes.

I was told to use <META HTTP-EQUIV="Refresh" CONTENT="300"> and place it inside the HEAD tags. Well this doesn't work because when I click on the link to go to the page, I get and error.

Does anyone have any ideas please?
Jul 11 '07 #1
9 4138
miller
1,089 Expert 1GB
and the error that you receive is?

- Miller
Jul 11 '07 #2
Oops sorry. Here it is:

"Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, @@ServerAdmin@@ and inform them of the time the error occurred, and anything you may have done to cause the error.
More information may be available in the server error log.
Apache/2.0.40 Server at 192.168.107.20 Port 80"

I checked the error log and it said:

[Wed Jul 11 12:44:37 2007] [error] [client 192.168.107.20] malformed header from script. Bad header= Missing gauge reports are ind: padata.pl
[Wed Jul 11 12:44:37 2007] [warn] /perl/PEMA/padata.pl did not send an HTTP header
[Wed Jul 11 12:44:37 2007] [error] [client 192.168.107.20] malformed header from script. Bad header= : padata.pl
[Wed Jul 11 12:44:37 2007] [warn] /perl/PEMA/padata.pl did not send an HTTP header
[Wed Jul 11 12:44:37 2007] [error] [client 192.168.107.20] malformed header from script. Bad header= Missing gauge reports are ind: padata.pl
[Wed Jul 11 12:44:37 2007] [warn] /perl/PEMA/padata.pl did not send an HTTP header
[Wed Jul 11 12:44:37 2007] [error] [client 192.168.107.20] malformed header from script. Bad header= Missing gauge reports are ind: padata.pl
[Wed Jul 11 12:44:37 2007] [warn] /perl/PEMA/padata.pl did not send an HTTP header
[Wed Jul 11 12:44:37 2007] [error] [client 192.168.107.20] malformed header from script. Bad header= Missing gauge reports are ind: padata.pl
[Wed Jul 11 12:44:37 2007] [warn] /perl/PEMA/padata.pl did not send an HTTP header

Any ideas? Thanks for the help.
Jul 11 '07 #3
Sorry to include so much in the above post. I just want to make sure all the info is available.

Let me know what you experts think. Thanks for the help. :)
Jul 12 '07 #4
KevinADC
4,059 Expert 2GB
Looks like your perl file is missing an http header. Can we see one of the perl files that generates these errors?
Jul 12 '07 #5
Here it is. I bolded the line where I have the refresh code. I have a comment mark in front of it right now but when I take it out, it gives me the error. Thanks.

# padata.pl
# ------------
# Displays All PA Tabular Data
#
# Author:
#
# Revisions: (none)
# ------------------------------------------------------------------------------

use strict;
use CGI ":standard";
use integer;


my $tome = time ;


print "Content-Type: text/html\n\n";

print "<BODY BGCOLOR=#CFEEFF TEXT=#1346AD BACKGROUND=/DWGraphics/DWBG.jpg>\n" ;

################################################## ################

# Stores Tabular Data File Path into a Var.
my $TabularData1 = "/Apache2/htdocs/DWTemp/TabularData$tome.txt" ;


# Creates the tabular text file to be displayed later in the page.
my $StationCommand25 = sprintf("/DW/Utils/reportgen.exe g=1 f=$TabularData1") ;
my $systemCommand25 = $StationCommand25 ;
system $systemCommand25 ;



# Opens the tabular text file and stores it's content in an array.
open (GReader, "<$TabularData1") || die "couldn't open the file!" ;
my @raw_data1 = <GReader> ;
close (GReader) ;

################################################## ################

# Stores Tabular Data File Path into a Var.
my $TabularData2 = "/Apache2/htdocs/DWTemp/TabularData$tome.txt" ;


# Creates the tabular text file to be displayed later in the page.
my $StationCommand25 = sprintf("/DW/Utils/reportgen.exe g=2 f=$TabularData2") ;
my $systemCommand25 = $StationCommand25 ;
system $systemCommand25 ;



# Opens the tabular text file and stores it's content in an array.
open (GReader, "<$TabularData2") || die "couldn't open the file!" ;
my @raw_data2 = <GReader> ;
close (GReader) ;

################################################## ################

# Stores Tabular Data File Path into a Var.
my $TabularData3 = "/Apache2/htdocs/DWTemp/TabularData$tome.txt" ;


# Creates the tabular text file to be displayed later in the page.
my $StationCommand25 = sprintf("/DW/Utils/reportgen.exe g=3 f=$TabularData3") ;
my $systemCommand25 = $StationCommand25 ;
system $systemCommand25 ;



# Opens the tabular text file and stores it's content in an array.
open (GReader, "<$TabularData3") || die "couldn't open the file!" ;
my @raw_data3 = <GReader> ;
close (GReader) ;

################################################## ################

# Stores Tabular Data File Path into a Var.
my $TabularData4 = "/Apache2/htdocs/DWTemp/TabularData$tome.txt" ;


# Creates the tabular text file to be displayed later in the page.
my $StationCommand25 = sprintf("/DW/Utils/reportgen.exe g=4 f=$TabularData4") ;
my $systemCommand25 = $StationCommand25 ;
system $systemCommand25 ;



# Opens the tabular text file and stores it's content in an array.
open (GReader, "<$TabularData4") || die "couldn't open the file!" ;
my @raw_data4 = <GReader> ;
close (GReader) ;

################################################## ################

# Stores Tabular Data File Path into a Var.
my $TabularData5 = "/Apache2/htdocs/DWTemp/TabularData$tome.txt" ;


# Creates the tabular text file to be displayed later in the page.
my $StationCommand25 = sprintf("/DW/Utils/reportgen.exe g=5 f=$TabularData5") ;
my $systemCommand25 = $StationCommand25 ;
system $systemCommand25 ;



# Opens the tabular text file and stores it's content in an array.
open (GReader, "<$TabularData5") || die "couldn't open the file!" ;
my @raw_data5 = <GReader> ;
close (GReader) ;

################################################## ################
# The HTML FILE IS CREATED HERE #
################################################## ################


print "<html>" ;

print "<head>" ;
#print "<META HTTP-EQUIV="Refresh" CONTENT="60">" ;

print "<title>Pennsylvania, Automated Flood Warning System</title>" ;
print "</head>" ;

print "<body alink='#ee0000' bgcolor='#ffffff' link='#0000fd' text='#000000' vlink='#551a8b'>" ;

#Menu Links.
print "<center>" ;
print "<a href='/iflows/index.htm'>HOME</a>" ;
print "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" ;
print "<a href='pa.pl'>IFLOWS MENU</a>" ;
print "</center><br>" ;

print "<center>" ;
print "<pre>" ;
print "<b>" ;
print "Data for <a href='Allegheny.pl'>Allegheny</a> County, Pennsylvania" ;
print "<BR>" ;
# Prints the tabular text data that is stored in the array to the screen.
print "@raw_data1" ;

print "</b>" ;
print "</pre>" ;
print "</center>" ;

print "<BR>" ;
print "<BR>" ;

print "<center>" ;
print "<pre>" ;
print "<b>" ;
print "Data for <a href='Armstrong.pl'>Armstrong</a> County, Pennsylvania" ;
print "<BR>" ;
# Prints the tabular text data that is stored in the array to the screen.
print "@raw_data2" ;

print "</b>" ;
print "</pre>" ;
print "</center>" ;

print "<BR>" ;
print "<BR>" ;

print "<center>" ;
print "<pre>" ;
print "<b>" ;
print "Data for <a href='Bedford.pl'>Bedford</a> County, Pennsylvania" ;
print "<BR>" ;
# Prints the tabular text data that is stored in the array to the screen.
print "@raw_data3" ;

print "</b>" ;
print "</pre>" ;
print "</center>" ;

print "<BR>" ;
print "<BR>" ;

print "<center>" ;
print "<pre>" ;
print "<b>" ;
print "Data for <a href='Bradford.pl'>Bradford</a> County, Pennsylvania" ;
print "<BR>" ;
# Prints the tabular text data that is stored in the array to the screen.
print "@raw_data4" ;

print "</b>" ;
print "</pre>" ;
print "</center>" ;

print "<BR>" ;
print "<BR>" ;

print "<center>" ;
print "<pre>" ;
print "<b>" ;
print "Data for <a href='Butler.pl'>Butler</a> County, Pennsylvania" ;
print "<BR>" ;
# Prints the tabular text data that is stored in the array to the screen.
print "@raw_data5" ;

print "</b>" ;
print "</pre>" ;
print "</center>" ;

print "<BR>" ;
print "<BR>" ;

print "</center>" ;
print "</body>" ;
print "</html>" ;

################################################## ################
Jul 12 '07 #6
KevinADC
4,059 Expert 2GB
You have double-quotes inside a double-quoted string, which will cause an error:

print "<META HTTP-EQUIV="Refresh" CONTENT="60">" ;

escape the double-quotes:

print "<META HTTP-EQUIV=\"Refresh\" CONTENT=\"60\">" ;


or more properly use a single-quoted string since there is no variable or meta character interpolation needed:

print '<META HTTP-EQUIV="Refresh" CONTENT="60">' ;

also, check the meta tag syntax to make sure it is correct for your application. I am not sure that CONTENT="60" is going to do anything.
Jul 12 '07 #7
Kevin:

That worked. Thank you so much. I had to escape the quotes because the single quotes were acting funky.

I now get my html refresh inside my PERL code. Thanks so much.

Matthew K.
Jul 13 '07 #8
miller
1,089 Expert 1GB
I had to escape the quotes because the single quotes were acting funky.
You should avoid having to explicitly escape quoting characters in a string. Instead just use a different quoting character. If you still want interpolation, then the following is what I choose:

print qq{<META HTTP-EQUIV="Refresh" CONTENT="60">};

perldoc perlop Quote and Quote-like Operators

- Miller
Jul 13 '07 #9
Thank you miller. That worked brilliantly. I am still very new to PERL and even HTML for that matter. Thank you both for your help.
Jul 13 '07 #10

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by Rick | last post: by
8 posts views Thread by Manu | last post: by
2 posts views Thread by no one | last post: by
1 post views Thread by worlman385 | last post: by
4 posts views Thread by Jeff | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.