Is this a place where I can get some technical input?

Hi everyone. It has been about 13 years since I last used Perl CGI. Recently, though, I was going through my old books and found an old Osborne Perl Reference guide and thought "Hey! I would mind having a brush up with Perl". Like the market place, I moved from Perl CGI to Classic ASP and then to .Net. One has to earn a living doesn't one? But I used to enjoy Perl. Thing is, I have just configured IIS 7 on a Windows 7 machine (running 32 bit version of Active Perl) and I am getting odd behaviour. I can open my browser, type in my local host website url (http://localhost/MyWebsite/Something.pl) and the request is picked up by the web server and returned. Problem is the the browser things its a download, prompts me to Run or Save. If I select Run it runs the script in a command window. This happens in all browsers so it must be an IIS issue. I have been through everything in IIS laboriously one setting at a time but can't see why this is happening. Does any of y'all have any idea why this might be happening? Cheers. Ray.

6 Comments

I'm not familiar with IIS but when this happens in Apache, it's because Apache isn't configured to run CGIs. I think this is a IIS configuration problem.

While hopefully someone can help you (and I agree with shawn, its sounds like server configuration) you will likely get help faster on one of the stackexchange sites. Stackoverflow.com is for programming (I use it regularly), IIRC serverfault.com is their servers site.

Again, I'm not saying not to bring your questions here, just that there are more people who are looking to answer questions there.

As Shawn says, it's almost certainly because IIS isn't configured to know how to deal with CGI programs.

Googling for "configure iis for cgi" gave a number of useful looking links. This one covers IIS 7.

http://community.activestate.com/forum-topic/configuring-perl-iis-7-0

But, if you ask on a Perl site rather than Stack Overflow, you're also hopefully more likely to get several someones who will tell you to skip CGI if you can, and use something that runs better and is less ancient: PSGI (based on WSGI if you're familiar with it). At YAPC there was a nice talk explaining why CGI.pm must die. http://act.perl.org.il/ilpw2012/talk/3936

There are likely slides already up somewhere.

See http://plackperl.org/ for pointers to all the new shiny of the post-CGI era. You do not even need to set up Apache. Just use the built-in stand-alone HTTP engine: launching your script using plackup will bring up a web server you can connect to immediately – no messing with a complex dæmon.

You can install Starman or Starlet for better-performing engines. (Starman is suitable for production.)

Then pick a web framework so you don’t write the sort of spaghetti code that CGIs used to devolve into. I guess Dancer is the choice for small projects these days.

And eventually, start looking into what PSGI lets you do with middlewares.

Leave a comment

About Ray

user-pic I blog about Perl.