PDA

View Full Version : Perl lib path for modules


tparkin
11-08-2005, 02:58 PM
I'm trying to do some perl stuff and I have basic scripts working in my cgi-bin/ folder. I'm now trying to use perl modules (.pm) but I can't get them to work! Where do I put the perl modules, I tried the same directory and tried creating a lib folder (since one didn't exist). Thanks in advance.

Kevin
11-10-2005, 12:13 AM
You have to put the modules in the proper install heirarchy for their name if they contain any namespacing, such as Net::Telnet, so that you have a directory called Net/ with Telnet.pm in it.

As for actually getting them to load in, you should push the directory containing the modules into @INC.

For example, you could put all your modules in:

/hsphere/local/home/user/lib, so Net::Telnet is in /hsphere/local/home/user/lib/Net/Telnet.pm

Then, in perl do a push(@INC, "/hsphere/local/home/user/lib"); and use Net::Telnet;

That should work.

Also, if the modules in question aren't too unusual, we can probably install them for you server-wide. Just let us know which you need and we'll see what we can do.

tparkin
11-10-2005, 03:50 PM
Kevin, Thanks for the response! It's working well now.