PDA

View Full Version : Using Perl Modules...


Lazy
4-20-03, 05:33 AM
Hi there,

If I want to use perl modules (for example CGI::FAST module or FileCache) stored in the library, what lib pragma do I use at the start of the perl script to indicate perl modules directory path in the script?

Will be grateful if anyone can help me.

Powsmilli
4-21-03, 09:54 PM
http://ops.powweb.com/powweb-bin/perldiver.cgi

I think

netaustin
4-22-03, 02:59 PM
is there a way to include in a lib in your own directories that could have a perl module that powweb doesn't have installed?

i'd really like to be able to use SOAP::Lite and Net::AIM, but neither are installed.

djeaux
4-23-03, 09:59 AM
Originally posted by netaustin
is there a way to include in a lib in your own directories that could have a perl module that powweb doesn't have installed?

Sure. Here's what I did.

(1) Create a "lib" directory inside your cgi-bin.

(2) Install the module on your local machine. Then locate it in the Perl installation directory.

You do have a local Perl installation for testing, right?

I'm using ActiveState's Win32 Perl locally, and user-installed modules go into C:\Perl\site\lib...

(3) Copy the directory structure and all files for the module into your "lib" directory on the server. Set all the permissions so the module will execute.

(4) Add a line like:

use lib('/www/u/username/cgi-bin/lib');

... before the "use XML::SOAP" line in your script.

(Of course, substitute your account name for "username" and the first letter of your account name for "u" in the path to the "lib".)

The real trick is getting the complete directory structure for the module. I haven't done SOAP::Lite but I suspect you'd have the following directory tree:

lib
---->SOAP
---------->Lite


This method worked fine for me to get XML::RSSLite for my scripts...


Joe

SimCoWeb
4-23-03, 10:40 AM
You can request that Admins install the module you need. If the module does not pose serious issues for security or resources then 99% of the time they'll install it. We've had lots of modules installed over the past 1 1/2 years :)

netaustin
4-23-03, 10:48 AM
Awesome, guys. Thanks a lot.

djeaux: I have EVERYTHING on my box for testing... Apache, MySQL, PHP, Perl, TCL, Python, and Servlet support in 3 or 4 other languages.

Lazy
4-26-03, 10:46 AM
Does anyone here knows how to use perl modules in the script???????

netaustin
4-26-03, 11:19 AM
the general way of calling installed modules is:
use Directory::Module

but if it's not installed, follow the instructions above.

what specifically are you trying to do?

simco - you were right... they installed soap::lite but not net::aim (i wouldn't really want my shared servers trying to deal with a messenger service either, but it was worth a shot).

SimCoWeb
4-26-03, 12:26 PM
netaustin, that's great :)

But you're right, installing a 'shared' module is not something they'd probably do. Powweb is extremely security conscious and there's lots of hackos out there as we all know

Lazy
4-27-03, 04:11 AM
Hi Netaustin,

Thanks for your reply.

I tried using CGI::Fast module in my script like this:

use CGI::Fast;

But it doesnt work...it gives server error (Error 500).
Do I have to use additional codes to instruct this module to make part of the script or whole script work faster?

patricko
4-27-03, 07:48 PM
SYNOPSIS
use CGI::Fast qw(:standard);
$COUNTER = 0;
while (new CGI::Fast) {
print header;
print start_html("Fast CGI Rocks");
print
h1("Fast CGI Rocks"),
"Invocation number ",b($COUNTER++),
" PID ",b($$),".",
hr;
print end_html;
}

try that

The above will only work if fcgi.pm is installed

patricko
4-27-03, 10:46 PM
Originally posted by Lazy
Hi Netaustin,

Thanks for your reply.

I tried using CGI::Fast module in my script like this:

use CGI::Fast;

But it doesnt work...it gives server error (Error 500).
Do I have to use additional codes to instruct this module to make part of the script or whole script work faster?


Ok scratch that PowWeb needs to install FCGI because CGI::Fast uses fcgi.pm module to function

perhaps you could request it

mrmagill
4-28-03, 02:36 AM
Originally posted by djeaux
You do have a local Perl installation for testing, right?

Well, Joe... in a word, "No." :(

I'm just getting started with all this, could you tell me how to go about setting up a Perl install on this Windows box? Is it just a matter of fetching the distrib file and installing? From where? I did have one years ago when a friend was working on some Perl scripts for me, but
-HE- was doing the work, not me...

Thanks much -
Mark

patricko
4-28-03, 02:48 AM
ActiveState.com (http://www.activestate.com/Products/ActivePerl/)

what I use on windows XP pro, home and 98

you got a lot of reading to do

then also add this

Xitami web server (http://www.xitami.com/)


then you can test everything before you upload it


Have fun

djeaux
5-1-03, 12:02 PM
Like patricko said, visit ActiveState (http://www.activestate.com/Products/Language_Distributions/) and fetch the binary distribution for Windows. They even have a nifty MSI installer which makes it even easier.

You'll need a Windows web server to run in loopback mode (address it as http://127.0.0.1) & you'll have to configure it to find Perl. Usually the latter is automatic if you use the normal directories for installing everything.

Perl is definitely worth learning. The syntax is "standard" & there are lots of things to do besides write CGIs with it. You can write little utilities for doing things on your desktop totally aside from the web, for example. And of course, whenever you learn something useful, you are doing a good thing for your brain, cognitively AND anatomically :cool:

Laurey
5-1-03, 02:40 PM
I personally use IndigoPerl for testing locally.. VERY easy to install, VERY easy to get going.

http://www.indigostar.com/

probably not as hardy as others.. but great for quick & easy ;)
-L