Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Firefox and heredoc problem

Reply
Thread Tools

Firefox and heredoc problem

 
 
phillyfan
Guest
Posts: n/a
 
      02-01-2006
I have a script with the code below in it. It works fine in IE, I know
the statement has been stated many times before, but does not display
correctly in Firefox.

Code:

#!/usr/bin/perl -w

use strict;
use POSIX;
use diagnostics;
use CGI qw(:all);
use Fcntl qw(:flock);
use DBI;
[...]

print << "WEB_PAGE";

<html>
<head>
<title>
UCR - $svcname $periodtime $rptype Report
</title>
<link REL="StyleSheet" TYPE="text/css"
HREF="http://$servername/css/angelica.css">
</head>
<body>
<div class=main>
<table cellpadding=5 border=1 align=center>
<tr>
<td colspan=10 align=center>
<p><B> $svcname $periodtime $rptype Report Summary</B></p>
<p>Requested by <B>$svcnum[1] $svcnum[2]</B><BR>
From $todate to $fromdate<BR>
As of $asoftime
</p></td>
</tr>
<tr>
<td class=header align=center>
Meter Serial Number
</td>
<td class=header align=center>
Meter Name
</td>
<td class=header align=center>
Meter Value
</td>
</tr>

</table>
<P><center><a class=body
href="http://$servername/cgi-bin/p/reports?opr=$opr">Go Back to Report
Parameters</A></center><P>
</div>
</body>
</html>
WEB_PAGE

Looking at the page IN IE it displays the HTML page as I intended. In
Firefox I get the following:

<html>
<head>
<title>
UCR - Houston Weekly Svc Report
</title>
<link REL="StyleSheet" TYPE="text/css"
HREF="http://scdadev.angelica.com/css/angelica.css">
</head>
<body>
<div class=main>
<table cellpadding=5 border=1 align=center>
<tr>
<td colspan=10 align=center>
<p><B> Houston Weekly Svc Report Summary</B></p>
<p>Requested by <B>Jay Santerre</B><BR>
From 01/25/2006 to 02/01/2006<BR>
As of 02-01-2006 09:44:22
</p></td>
</tr>
<tr>
<td class=header align=center>
Meter Serial Number
</td>
<td class=header align=center>
Meter Name
</td>
<td class=header align=center>
Meter Value
</td>
</tr>

</table>
<P><center><a class=body
href="http://scdadev.angelica.com/cgi-bin/p/reports?opr=JSANTERRE">Go
Back to Report Parameters</A></center><P>
</div>
</body>
</html>

Please advise. I have done a search to try and find the error of my
ways but have not found any one else with the issue I am having with a
solution.

 
Reply With Quote
 
 
 
 
John W. Kennedy
Guest
Posts: n/a
 
      02-01-2006
phillyfan wrote:
> I have a script with the code below in it. It works fine in IE, I know
> the statement has been stated many times before, but does not display
> correctly in Firefox.
>
> Code:
>
> #!/usr/bin/perl -w
>
> use strict;
> use POSIX;
> use diagnostics;
> use CGI qw(:all);
> use Fcntl qw(:flock);
> use DBI;
> [...]
>
> print << "WEB_PAGE";
>
> <html>
> <head>
> <title>
> UCR - $svcname $periodtime $rptype Report
> </title>
> <link REL="StyleSheet" TYPE="text/css"
> HREF="http://$servername/css/angelica.css">
> </head>
> <body>
> <div class=main>
> <table cellpadding=5 border=1 align=center>
> <tr>
> <td colspan=10 align=center>
> <p><B> $svcname $periodtime $rptype Report Summary</B></p>
> <p>Requested by <B>$svcnum[1] $svcnum[2]</B><BR>
> From $todate to $fromdate<BR>
> As of $asoftime
> </p></td>
> </tr>
> <tr>
> <td class=header align=center>
> Meter Serial Number
> </td>
> <td class=header align=center>
> Meter Name
> </td>
> <td class=header align=center>
> Meter Value
> </td>
> </tr>
>
> </table>
> <P><center><a class=body
> href="http://$servername/cgi-bin/p/reports?opr=$opr">Go Back to Report
> Parameters</A></center><P>
> </div>
> </body>
> </html>
> WEB_PAGE
>
> Looking at the page IN IE it displays the HTML page as I intended. In
> Firefox I get the following:
>
> <html>
> <head>
> <title>
> UCR - Houston Weekly Svc Report
> </title>
> <link REL="StyleSheet" TYPE="text/css"
> HREF="http://scdadev.angelica.com/css/angelica.css">
> </head>
> <body>
> <div class=main>
> <table cellpadding=5 border=1 align=center>
> <tr>
> <td colspan=10 align=center>
> <p><B> Houston Weekly Svc Report Summary</B></p>
> <p>Requested by <B>Jay Santerre</B><BR>
> From 01/25/2006 to 02/01/2006<BR>
> As of 02-01-2006 09:44:22
> </p></td>
> </tr>
> <tr>
> <td class=header align=center>
> Meter Serial Number
> </td>
> <td class=header align=center>
> Meter Name
> </td>
> <td class=header align=center>
> Meter Value
> </td>
> </tr>
>
> </table>
> <P><center><a class=body
> href="http://scdadev.angelica.com/cgi-bin/p/reports?opr=JSANTERRE">Go
> Back to Report Parameters</A></center><P>
> </div>
> </body>
> </html>
>
> Please advise. I have done a search to try and find the error of my
> ways but have not found any one else with the issue I am having with a
> solution.


That's because (apparently) you're coding in a way that /requires/ one
of Microsoft's typical bugs to be present. The HTTP protocol requires a
"content-type" header line /saying/ that an HTML (or plain text, or
JPEG, or whatever) document follows. Microsoft, with their typical
arrogance, decided that, rather than follow the rules, they'd rather
poke around in the file to see what it looks like, and then guess.
(Hundreds of viruses have been written to take advantage of this wrong
and /stupid/ behavior.) As it happens, in your case, it is correctly
guessing that the file is HTML. But it isn't supposed to be guessing at all.

Firefox is doing what it's supposed to do.

Provide a proper HTTP header.

--
John W. Kennedy
"But now is a new thing which is very old--
that the rich make themselves richer and not poorer,
which is the true Gospel, for the poor's sake."
-- Charles Williams. "Judgement at Chelmsford"
 
Reply With Quote
 
 
 
 
Jürgen Exner
Guest
Posts: n/a
 
      02-02-2006
phillyfan wrote:
> I have a script with the code below in it. It works fine in IE, I
> know the statement has been stated many times before, but does not
> display correctly in Firefox.


Then why don't you ask in a NG that actually deals with web browsers and
their differences?

jue


 
Reply With Quote
 
Tintin
Guest
Posts: n/a
 
      02-02-2006

"phillyfan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> I have a script with the code below in it. It works fine in IE, I know
> the statement has been stated many times before, but does not display
> correctly in Firefox.


Not a Perl issue.

Firefox just happens to adhere to HTTP/HTML standards, whereas IE breaks
them. If you output correct HTTP headers, firefox and any other compliant
browser will work just fine.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to heredoc without interpolation and backslash interpretation with arbitrary length delimiter support ashishwave Ruby 3 08-17-2007 01:13 PM
eval, HereDoc and Regular Expressions atraver@gmail.com Ruby 3 01-27-2007 09:46 AM
Heredoc and array / hash construction syntax error David Tran Ruby 6 03-17-2005 05:38 PM
heredoc and variables flupke Python 7 06-07-2004 11:53 AM
lil problem w/heredoc Paul Vudmaska Ruby 2 04-07-2004 03:52 PM



Advertisments