PDA

View Full Version : Custom Perl Modules for CGI-BIN


idealord
10-05-2008, 01:44 PM
I've had my perl custom libraries working for a while now with a 'use lib' directive. But I've never been able to get my cgi-bin perl scripts to use a custom library.

I've tried putting it into a folder directly below the folder it's in. Right now I have a script in www/temp that I'm trying to get to work. This script runs fine from an ssh session, but fails 500 when hit by a browser.

I'm using:

use lib 'lib';

And then I have a lib folder at www/temp/lib which has Finance and then the YahooQuote.pm custom perl module. I see that MovableType does this.

Thanks!

Terra
10-05-2008, 01:50 PM
Try specifying the full path to that directory, instead of the relative pathing you are using now...

idealord
10-05-2008, 02:06 PM
Thanks Terra, that was the first thing I tried and no luck. The CNC Error Console says nothing special:

%% [Sun Oct 5 13:05:14 2008] GET /temp/slw-hte.cgi HTTP/1.1
%% 500 /big/dom/xparnasse/www/temp/slw-hte.cgi
%request
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Encoding: gzip,deflate
Accept-Language: en-us,en;q=0.5
Cache-Control: max-age=0
Connection: keep-alive
Host: parnasse.com
Keep-Alive: 300
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3
%response

All the dirs are executable. Hmmm...

Terra
10-05-2008, 03:14 PM
I looked at the script and no it won't work as is...

You are not emitting the "Content-type:", therefore Apache sees it as an error...

Place this towards the top, after the 'use' lines:
print "Content-type: text/html\n\n";
print "Success\n";

idealord
10-05-2008, 03:21 PM
Thanks again Terra! You didn't need to go out of your way, as long as the libs thing should be working! Got it working thanks!!

Terra
10-05-2008, 03:47 PM
:)

idealord
10-05-2008, 04:37 PM
Nice! I successfully have a Atom->RSS 2.0 converter proxy that fixes a bug in the feed parsing of http://netnewmusic.net/reblog - New Music reBlog.

Thanks again Terra!