So, I don't use CGI a lot much these days. But I recently wrote a little joke module and decided to make a little HTML form interface for it. Plack would be a sensible way of doing the interface, but this was just a silly little thing and I was feeling lazy, so I coded it up using CGI instead. I'd used Moo rather than Moose so speed shouldn't have been an issue.
I uploaded it to the server and visited the page and it just showed me my Perl source code. Hmmm…
Create .htacccess and add the following lines:
Options +ExecCGI AddHandler cgi-script .cgi .pl
Visit the page again… still showing the source code. Hmmm…
Scratch head for five minutes. Open up httpd.conf, add:
<Directory /path/to/my/vhost/> AllowOverride all </Directory>
Visit the page again… still showing the source code. Hmmm…
SSH into the server and run ./myscript.cgi from the command line.
"uniq" is not exported by the List::Util module
Okay, I must have an old version of it. Upgrade.
Visit the page again… still showing the source code. Hmmm…
Stop using List::Util entirely.
sub uniq { my %seen; grep !$seen{$_}++, @_; }
Visit the page again… still showing the source code. Hmmm…
Scratch head for ten minutes. Rename to ./myscript.pl.
Visit the page again… still showing the source code. Hmmm…
Create the following file and mark it as executable:
#!/bin/sh echo "Content-Type: text/plain"; echo ""; echo "Hello world";
Visit my new page… also showing the source code. Hmmm…
Scratch head some more.
Consider buying anti-headlice shampoo.
Finally… FINALLY… after about TWO HOURS I figure out the problem! It was…
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How easy it is to make mistakes
by hippo (Archbishop) on May 23, 2017 at 11:34 UTC | |
by tobyink (Canon) on May 23, 2017 at 13:12 UTC | |
by Your Mother (Archbishop) on May 23, 2017 at 13:24 UTC | |
by Jenda (Abbot) on May 23, 2017 at 14:09 UTC | |
|
Re: How easy it is to make mistakes
by shmem (Chancellor) on May 23, 2017 at 13:59 UTC | |
by tobyink (Canon) on May 23, 2017 at 17:42 UTC | |
by Your Mother (Archbishop) on May 24, 2017 at 12:20 UTC | |
|
Re: How easy it is to make mistakes
by talexb (Chancellor) on May 24, 2017 at 03:55 UTC | |
|
Re: How easy it is to make mistakes
by karlgoethebier (Abbot) on May 24, 2017 at 09:57 UTC | |
|
Re: How easy it is to make mistakes
by locked_user sundialsvc4 (Abbot) on May 30, 2017 at 15:04 UTC |