Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Perl Modules + different location

Status
Not open for further replies.

mikedaruke

Technical User
Mar 14, 2005
199
US
Guys I have a question that may be easy to answer for some of you.

At work I got a share on a webserver. It runs Perl 5.8 The problem is I need different modules. Like Excel Spreadsheet, Mail, etc. They are not installed on the webserver. I don't have access to make updates to Perl and the company doesn't seem like they will either. Is there anyway I can have the modules on my share and refer to them in my Perl Script from that location?

This is also a problem for sites like lunarpages.com where they do webhosting. They have Perl for you to use but they don't have any modules I would need. So what are my options if I cant get the company to install these modules?

thanks
 
Easiest if you have some kind of command shell access to the server (like ssh). You can use CPAN just like you would as a server admin, except you can change the install path to somewhere in your local user space. Then, all you need is the 'use lib' directive at the top of your scripts that need the extra modules.

If you don't have shell access, life gets harder. The modules that are pure-perl, you can just copy the source out there from cpan.org.

For the ones that need compilation, you have two options, neither of which are overly easy. First, you can try to run the typical perl Makefile.PL/make/make install kind of thing from a perl script. It's hard to get good error messages back sometimes, and if the script prompts you for something, it gets worse. If you're fluent in Expect, this may be cake, but I never was.

Second, you need to find your server specs: platform, OS, and Perl versions. For example, x86, RedHat 8.0, Perl 5.8.7. With this information, you can search for compatible binaries on the internet and upload them. Many shared hosting servers run some flavor of Red Hat, and there's a lot of RPM's out there. You can probably hunt down what you need.

- Andrew
Text::Highlight - A language-neutral syntax highlighting module in Perl
also on SourceForge including demo
 
Its a Windows Box and its running IIS for a webserver.

I don't have access to a command shell.

I just thought some how I can have the modules somewhere else and just point to them?

 
Makes it even easier, I suppose, as there's many ppm's available. Look at the use lib directive to add the location of wherever you put the new ones.

- Andrew
Text::Highlight - A language-neutral syntax highlighting module in Perl
also on SourceForge including demo
 
I am still confused.

I have a directoy in my share that I will put Perl modules. What can I do to have Perl search for the modules in that directory?

I tried using 'use lib ''; but I don't seem to have the right path or something.

Can I just ask the web admin to add my directory to the Perl Environmental variable or something?

 
You have to pass the path to the directive. For example:

use lib 'C:/inetpub/webroot/modules';

And that path is prepended to @INC, which is where Perl checks for modules when you use them.

- Andrew
Text::Highlight - A language-neutral syntax highlighting module in Perl
also on SourceForge including demo
 
Yes I undertand that and I did that. Thanks!

My problem is this is a windows box that I don't have a command prompt to. So I need to have these modules installed right? I can't just put them in a folder and link to them in my script.

I need to know how to install these if possible on a shared webserver.

There has to be a way, I mean if you buy a share server from one of those web hosting places they say they have Perl. But lets say you want to use a Spread-sheet module then what do you do? Thanks again!
 
Ok I am guessing its not possible.

Without any command prompt(telnet, ssh, cmd) there is not way to install the modules.

You can put them on your share, and link to them but they never work when they aren't installed.

Everyone agree? Help?
 
I need to know how to install these if possible on a shared webserver.

There has to be a way, I mean if you buy a share server from one of those web hosting places they say they have Perl. But lets say you want to use a Spread-sheet module then what do you do?
what kind of company sells web hosting and they don't provide command line?


``The wise man doesn't give the right answers,
he poses the right questions.''
TIMTOWTDI
 
Where do you people find such hosting? I agree it's less than smart and reflects poorly on the hosting if they can't keep shell access secure, but last time I hunted for inexpensive website hosting, it was very rare to find one that did offer SSH access.

Mike, don't give up, ye of little faith. First step is to find a pre-compiled version of your module. For that, head over to ActiveState's zipped module listing:
From there, pick your target perl version, then platform, and find the module you're after in the large list. If it's not in this list, then you've a lot of work ahead of you if you want it to work (have a VC7 compiler?).

Download the .zip file to your local machine. For my example, I'm using ActivePerl 8xx on Windows and trying to use Date::Calc. I pick the most recent version and grab the zip and open it. Once there, open the module archive itself in MSWin32-x86-multi-thread-5.8\Date-Calc-5.4.tar.gz which will then contain a lone blib directory, which contains several other directories. Extract this somewhere convienent.

Next step is to get the module data to the server. Upload blib and everything inside it, keeping the directory structure, to your target server. I put it in my script's working directory. Then, at the top if the script, you have to reference where you put the module.
Code:
[COLOR=#0000FF]use[/color] lib [COLOR=#808080]'blib/lib'[/color];  [COLOR=#006600]# the perl parts of the module[/color]
[COLOR=#0000FF]use[/color] lib [COLOR=#808080]'blib/arch'[/color]; [COLOR=#006600]# the binary parts of the module[/color]
[COLOR=#0000FF]use[/color] Date::Calc;      [COLOR=#006600]# now I can use the module in the above dirs[/color]
Just change paths and module names for what you're looking for and where you're putting it.

It's very possible to add non-standard modules with very limited access, and on x86 Windows, you have the enormous ActiveState binary module list to work with. Sure is easier than hunting down rpm's amidst dozens of variables.

- Andrew
Text::Highlight - A language-neutral syntax highlighting module in Perl
also on SourceForge including demo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top