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

While bringing up mod_perl on W2k, I ran into an annoying situation: IE will try and do its own thing with a file where it recognizes the extension. In this case it offers to 'Open' or 'Save' the file that it claims it is 'Downloading'. This instead of quietly minding it's own business and allowing Apache to invoke Apache::Registry. If I delete the '.pl' entry in the registry, everything works fine. If I run Opera instead of IE, everything works fine. If I name the file whatever.plx, everything works fine. What I would like is for IE to stop doing me a favor---but I am sadly ignorant of how to accomplish this DWIMish goal! Surely some fellow monk has travelled this road before?

--hsm

"Never try to teach a pig to sing...it wastes your time and it annoys the pig."

Replies are listed 'Best First'.
Re: mod_perl, IE and DWIM
by cees (Curate) on Jul 20, 2003 at 18:39 UTC

    IE can be a real pain in situations like this, but I would guess that you are doing something wrong somewhere...

    Have a read of "MIME Type Detection in Internet Explorer" for a primer on how IE figures out the content type.

    In there you can see that Microsoft is trying to make up for mistakes that web developers and server administrators sometimes make. Of course if they would just follow the rules instead, then maybe these web developers would learn something instead. Instead, they frustrate developers who do actually know what they are doing.

    Back to your problem. Is it possible that you are not returning the content type of text/html? Is your HTML document not properly formatted (does it start with <HTML> or a proper doctype? Or are you returning image data and leaving the content type as text/html? Try a very simple example that you know is correct and see what results you get.

    #!/usr/bin/perl use CGI qw/:standard/; print header, start_html('Hello World!'), h1('Hello World!'), end_html;

    - Cees

      Same file with different extension (.pl changed to .plx) works as expected, so the problem doesn't seem to be the content of the file, just what it's called! Here is one of the test programs from Practical Mod_Perl
      #!/perl/bin/perl # # mod_perl_rules1.pl use strict; use warnings; use diagnostics; print "Content-type: text/plain\n\n"; print "mod_perl rules!\n";
      which runs as a .plx, but not as a .pl!

      --hsm

      "Never try to teach a pig to sing...it wastes your time and it annoys the pig."
        Just for fun: could you try with the extension .nl ?

        The reason why I'm asking this, is that .pl is also the tld for Poland, and is also used as an identifier for Polish as a language, so there may be an issue with Content-Negotiation. If .nl gives the same problem, then it's probably related to that. If not, ask Bill. ;-)

        Liz

•Re: mod_perl, IE and DWIM
by merlyn (Sage) on Jul 20, 2003 at 17:51 UTC
    You should install a standard browser, instead of IE.

    Or call Microsoft Technical Support and ask them how to get IE to follow the standards.

    But seriously, redmond-ware is often broken, and you've come across an example. Webwhackers around the world are constantly trying to work around the DWIMmery of perhaps-well-intended but definitely misled programmers from the behemoth-that-is-Microsoft.

    -- Randal L. Schwartz, Perl hacker
    Be sure to read my standard disclaimer if this is a reply.

Re: mod_perl, IE and DWIM
by bobn (Chaplain) on Jul 20, 2003 at 18:08 UTC

    Typical MS nonsense - it should certainly let the server respond and decide what to do based on the 'Content-type' header. Clearly non-standard behaviour.

    I think you're probaly stuck with using .plx in the filename, unless you can get all your users to chnage their registry settings. Is there a reason this is a problem?

    --Bob Niederman, http://bob-n.com
      No---just your standard PITA!

      --hsm

      "Never try to teach a pig to sing...it wastes your time and it annoys the pig."