Kamphuys, ing. K.G. (Koen) wrote:
> Hi all,
> 
> I have a weird problem using a script in a CGI environment together with
> Mozilla Firefox (1.0.3) that, to me, makes no sense at all, but I hope it
> does to you. 
> 
> Here's what happened to me.
> 
> I have a neatly running database-oriented application in Perl based on a
> script that acts as a developing tool and is being used intensively for 6
> years now on our intranet and internet sites.  The application works fine in
> MSIE6 and Opera7.11, but in Firefox1.0.3, the browser does not show the
> contents in the main screen but starts the download-or-open dialog ('You
> have chosen to open query.pl which is a: PL file, from www2.minlnv.nl. What
> should Firefox do with this file: Open with / Save to disk').  When I choose
> 'Save to disk' the saved file is the exact HTML that should have been opened
> in the browser.  So, all code is executed fine.
> 
> Sounds like an incorrect http header to me.  The script starts with some
> 'use'-commands, then
> print "Content-Type: text/html\n\n";
> then a few subroutines, then the main program.
> 
> When I change my script as follows:
> print "Content-Type: text/html\n\n";
> print 'x';
> exit;
> followed by my original code, same behaviour (including just an 'x' in the
> downloaded file)
> 
> Now for the weird part of it.
> 
> When I change my script as follows:
> print "Content-Type: text/html\n\n";
> print 'x';
> exit;
> *and delete* the rest of the code, the browser shows 'x' instead of the
> dialog.
> 
> Note that this was code that compiles and executes without problems.  It
> makes a difference *after* the exit statement.  The remaining code has no
> END routines so I expect exit does not more than exit.  Changing exit to
> exit(0) or exit(1) makes no difference.
> 
> BTW. When I replace the self-contructed header with
> $cgiobj = new CGI;
> print $cgiobj->header;
> the same behaviour.
> 
> And then, finally, when I try the following script:
> 
> use LWP::Simple;
> print "Content-Type: text/html\n\n";
> $doc = get
> 'http://www2.minlnv.nl/cgi-bin/database/query.pl?config=/thema/groen/ffwet/s
> oorten&snp=zoeken-public';
> print $doc;
> I *do* get my content in the browser window, which indicates that the sent
> HTML is not the cause.

You could try adding this to the front of your code:

BEGIN { use CGI::Carp qw(fatalsToBrowser); }

I would move the
        print "Content-Type: text/html\n\n";
to that begin block also to make sure it gets out before anything else.

Try making a smaller hello world script that fails and post it to make
sure it's not a server misconfig problem.  Your current script is too
big to mess with and doesn't have strict or warnings turned on.

> ---------------------
> Server OS: Win2000
> Webserver: IIS 5
> Authentication: none required (public)
> Perl version: 518 (yeah I know)
> Affected url: any link to /cgi-bin/database/query.pl under
> http://www2.minlnv.nl/thema/groen/ffwet/soorten/intro.htm
> Program code: available from http://www.agro.nl/tmp/query.zip - you'll get a
> nice impression of my programming style of 6 years ago :-) but I can't
> possibly ask you to take a dive into the code details.


-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to