Firefox and heredoc problem

Discussion in 'Perl Misc' started by phillyfan, Feb 1, 2006.

  1. phillyfan

    phillyfan Guest

    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.
     
    phillyfan, Feb 1, 2006
    #1
    1. Advertising

  2. 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"
     
    John W. Kennedy, Feb 1, 2006
    #2
    1. Advertising

  3. 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
     
    Jürgen Exner, Feb 2, 2006
    #3
  4. phillyfan

    Tintin Guest

    "phillyfan" <> wrote in message
    news:...
    > 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.
     
    Tintin, Feb 2, 2006
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. flupke

    heredoc and variables

    flupke, Jun 4, 2004, in forum: Python
    Replies:
    7
    Views:
    3,346
    =?ISO-8859-1?Q?Xavier_Mart=EDnez?=
    Jun 7, 2004
  2. Paul Vudmaska

    lil problem w/heredoc

    Paul Vudmaska, Apr 7, 2004, in forum: Ruby
    Replies:
    2
    Views:
    134
    Paul Vudmaska
    Apr 7, 2004
  3. David Tran
    Replies:
    6
    Views:
    781
    Eric Hodel
    Mar 17, 2005
  4. Replies:
    3
    Views:
    164
    Wolfgang Nádasi-Donner
    Jan 27, 2007
  5. ashishwave
    Replies:
    3
    Views:
    143
    ashishwave
    Aug 17, 2007
Loading...

Share This Page