Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Why, sometimes, when I attempt to load a page generated by a perl script does my browser try to download the perl file? This used to happen to me on everything on and off.

Replies are listed 'Best First'.
Re: browser downloading perl script
by Anonymous Monk on Feb 28, 2000 at 18:44 UTC
    Try loading this page a few times and see if you don't get a box asking you to download:
    http://everything.blockstackers.com/everything.pl?lastnode=jwz&node=about%3Ajwz

    This is different though because you download html instead of actual perl like mine is doing, but I think it's the same type of thing.

Re: browser downloading perl script
by Anonymous Monk on Feb 26, 2000 at 03:57 UTC
    Try loading this page a few times and see if you don't get a box asking you to download:
    http://everything.blockstackers.com/everything.pl?lastnode=jwz&node=about%3Ajwz

    This is different though because you download html instead of actual perl like mine is doing, but I think it's the same type of thing.

      That URL you supplied works for me -- no box, no download, and I have a miniature test lab, Windows only :-(, at my disposal. Sounds like it might be something unique to your setup after all.
Re: browser downloading perl script
by Anonymous Monk on Mar 01, 2000 at 14:02 UTC
    Are you trying to run it on a unix server? check file permissions are set to 755
Re: browser downloading perl script
by btrott (Parson) on Feb 25, 2000 at 23:50 UTC
    I don't know why this would happen "on and off," but this is most likely due to bad server configs. Your web server needs to associate a certain file extension (.pl, perhaps) w/ being a Perl script so that it knows to execute it and not just shove the contents of the script back to the browser. So it's not your browser--it's the web server.
Re: browser downloading perl script
by nickcave25 (Acolyte) on Feb 26, 2000 at 13:09 UTC
    Here's something that definitely triggers the kind of event you are talking about, especially when using Internet Explorer 5.0: forgetting to print out the MIME/HTML header.

        print "Content-type: text/html\n\n";
    What you described just happened to me (I downloaded the output of my script as a file and saved it to my so-called \Desktop) because my MIME/HTML header printing subroutine is foobar'ed for some reason. Hopefully, I will be able to fix it.
    Otherwise, I will cry.
fix your server...
by howard40 (Beadle) on Feb 27, 2000 at 08:32 UTC
    as was said above, it is almost certainly a server misconfiguration. the server needs to know what to do with the thing you're requesting (execute it or show it). if your web server isn't setup correctly, it will not execute the perl script, and will assume it to be "just another text file", thus returning the code of the perl script. since you're on a windows box, try mucking around in the "file associations" config screen, since the problem you're having is probably that the file extension of your scripts is not setup as a "Perl Script that should be executed" in the server. --- if all you need is a server to do static HTML/CGI stuff for testing purposes only, i recomend Sambar (http://www.sambar.com/). it's free, supports CGI, and is incredibly easy to setup/use.