View Full Version : what if host doesn't have module installed?
shadkeene
02-01-2008, 06:34 PM
Hi,
I've got some scripts I'd like to run, but I'm having problems with my webhost service (startlogic) installing the perl modules I need to run the program.
They mentioned I could bypass that and call the modules from my own website directory.
Does anyone know of a good tutorial that explains how to use a perl module that isn't installed on the server that my website is using?
Thanks for any help,
Shad
FishMonger
02-01-2008, 07:55 PM
This should help.
http://theoryx5.uwinnipeg.ca/CPAN/perl/pod/perlmodinstall.html
KevinADC
02-01-2008, 08:23 PM
If it is not a big complex module with lots of dependencies (although you can still do it this way if it is) you use the "lib" pragma to include your own module directories into perls @INC array. Say you have a module named Foo::Bar.
Foo is the directory the module is stored in and the module is named Bar.pm. You can create a Foo directory in any folder on your website, but best to use one that is not www accessible. People often name it mymodules or cpanmodules. In that folder you duplicate the modules structure, so you create a folder named Foo in mymodules folder and place Bar.pm in the Foo folder. Then in your perl script:
use lib qw(path/to/mymodules);
use Foo::Bar;
shadkeene
02-01-2008, 09:09 PM
you guys are so helpful...I'll give those methods a try...thanks for your time,
Shad
shadkeene
02-02-2008, 09:44 PM
Kevin,
I've been reading some of the documentation, and I'm attempting to place two modules, html::tokeparser::simple and geo::ellipsoid into my website directory. So, how do I physically place the module's contents into the folder on my website? I know how to put it on my own computer using the install function or something similar, but how do I replicate that for a remote server?
Finally, any suggestions for a web host service that has better service for installing perl modules? Startlogic customer service is horrible. I should have done more homework before picking them.
Thanks,
oesxyl
02-02-2008, 10:35 PM
Kevin,
I've been reading some of the documentation, and I'm attempting to place two modules, html::tokeparser::simple and geo::ellipsoid into my website directory. So, how do I physically place the module's contents into the folder on my website? I know how to put it on my own computer using the install function or something similar, but how do I replicate that for a remote server?
Finally, any suggestions for a web host service that has better service for installing perl modules? Startlogic customer service is horrible. I should have done more homework before picking them.
Thanks,
if you have cpanel installed, in newer version you have a panel for installing perl module, I don't know how well work but you could try it.
Another posibility is if you have ssh access to install via ssh.
I don't know how startlogic is but I don't think there is a big differences between hosts in this problem because most of them are php oriented and newer wave on ruby. I have sites on few hosts and the only difference is how match I pay, :)
Maybe a host perl oriented, but when I search I found only hosts with slow connection.
dedicated server is a solution if you can save your money.
best regards
KevinADC
02-02-2008, 11:33 PM
Yes, that is true, many newer control panels have a module install feature so you may want to check that.
As far as placing the modules on your site. Copy and paste the source code of the module into a text document just like you would with any other perl script. Most modules have the source code posted on CPAN, you will see a link called "Source". Click on it and copy and paste the code to a text file. Name the module like I described above. Make the directory structure as described above. Using your ftp program or website control panel. Then just transfer the module to your website however you do with your other perl scripts. Via FTP or a control panel using a web form are the two most likely methods. You may have to set the chmod to 700 or 755. 700 generally works for modules since they are used internally by your scripts and not run by direct access from the web.
nkrgupta
02-03-2008, 06:27 PM
I had written a blog post here (http://journal.naveeng.com/2007/10/16/install-perl-modules-without-root/) a few months ago trying to explain how I overcame a similar situation. It might be helpful, along with the comment by Dave down there.
However, it illustrates "how I applied" the guidelines pointed to and explained by FishMonger and KevinADC here.
You might need to tweak it according to your needs.
Also, If you have shell access to your webhosting account, you can follow the instruction here (http://wiki.dreamhost.com/CPAN) by Dreamhost, explaining how to setup CPAN on a shared environment.
shadkeene
02-03-2008, 08:16 PM
Thanks...great tutorial...I'll give that a try,
Shad
FishMonger
02-04-2008, 01:58 AM
Beginning quote from your blog:How many times PERL developers have....Please don't take offense, but this is one of the times where I'll be "nit picky". It's Perl or perl; not PERL. It's not an acronym.
http://en.wikipedia.org/wiki/Perl
nkrgupta
02-04-2008, 05:55 AM
Beginning quote from your blog:Please don't take offense, but this is one of the times where I'll be "nit picky". It's Perl or perl; not PERL. It's not an acronym.
http://en.wikipedia.org/wiki/Perl
I'll take that FishMonger [:)] Not the first time that someone tries to educate me on the usage of the term. However, it was quite some time after that blog post, that another Perl guru had lambasted me for using the term PERL in a powerpoint presentation, saying that Perl is the language and perl is the interpreter. There is no such thing as PERL.
Thanks for the correction.
PS: The blog post in question has been rectified and others too will be done soon.
shadkeene
02-13-2008, 12:00 AM
I finally got an opportunity to install the perl modules into directories on my website(since my host won't install them), and so far it seems like my geo::ellipsoid module is working perfectly(thanks!), but my HTML::TokeParser::Simple module is not being found. Is it because the structure of the second module is more complicated? My first module is in my lib folder...as Ellipsoid.pm, and use Geo::Ellipsoid is working.
So, now I have an HTML directory in the lib directory with all the .pm's that come with HTML::TokeParser::Simple, and I included TokeParser.pm as well.
Any advice on how to set up the module with multiple directories(multiple "::")?
Thanks for any help,
Shad
KevinADC
02-13-2008, 12:27 AM
HTML::TokeParser::Simple
the above equates to:
folder/folder/module
thats how you should set it up:
HTML/TokeParser/Simple.pm
then you include
use lib('path/to/HTML/TokeParser');
FishMonger
02-13-2008, 12:47 AM
HTML::TokeParser::Simple
the above equates to:
folder/folder/module
thats how you should set it up:
HTML/TokeParser/Simple.pm
then you include
use lib('path/to/HTML/TokeParser');
The lib statement should only need the path to the top level dir.
use lib('path/to/HTML');
shadkeene
02-13-2008, 03:32 AM
I probably should have stopped for the night, but I want to get this working...
I've got a couple errors...here's how I'm calling it in the code(this way works for my other program that only depends on the simple geo::ellipsoid module)...
BEGIN { unshift @INC, "/home/users/web/b1758/sl.jskeene/public_html/cgi-bin/lib/HTML"; }
use HTML::TokeParser::Simple;
When using the geo::ellipsoid module, I use everything like above but just use ...cgi-bin/lib.
Now, I added an HTML folder, and have added all the necessary modules into that. I get this error using all the modules as they were when I downloaded them...
HTML::Parser object version 3.55 does not match bootstrap parameter 3.56 at /usr/local/lib/perl5/5.8.8/i686-linux/DynaLoader.pm line 253.
Compilation failed in require at /home/users/web/b1758/sl.jskeene/public_html/cgi-bin/lib/HTML/Entities.pm line 147.
Compilation failed in require at /home/users/web/b1758/sl.jskeene/public_html/cgi-bin/lib/HTML/TokeParser.pm line 11.
BEGIN failed--compilation aborted at /home/users/web/b1758/sl.jskeene/public_html/cgi-bin/lib/HTML/TokeParser.pm line 11.
Compilation failed in require at /home/users/web/b1758/sl.jskeene/public_html/cgi-bin/lib/HTML/TokeParser/Simple.pm line 4.
BEGIN failed--compilation aborted at /home/users/web/b1758/sl.jskeene/public_html/cgi-bin/lib/HTML/TokeParser/Simple.pm line 4.
Compilation failed in require at /home/users/web/b1758/sl.jskeene/public_html/cgi-bin/CWAcoordsweb.cgi line 367.
BEGIN failed--compilation aborted at /home/users/web/b1758/sl.jskeene/public_html/cgi-bin/CWAcoordsweb.cgi line 367.
So...adjust the module to read version 3.55 and get this error now:
Can't locate HTML/TokeParser/Simple/Token.pm in @INC (@INC contains: /home/users/web/b1758/sl.jskeene/public_html/cgi-bin/lib/HTML /home/users/web/b1758/sl.jskeene/public_html/cgi-bin/lib /usr/local/lib/perl5/5.8.8/i686-linux /usr/local/lib/perl5/5.8.8 /usr/local/lib/perl5/site_perl/5.8.8/i686-linux /usr/local/lib/perl5/site_perl/5.8.8 /usr/local/lib/perl5/site_perl /usr/local/lib/perl/5.8.4 /usr/local/lib/site_perl .) at /home/users/web/b1758/sl.jskeene/public_html/cgi-bin/lib/HTML/TokeParser/Simple.pm line 5.
BEGIN failed--compilation aborted at /home/users/web/b1758/sl.jskeene/public_html/cgi-bin/lib/HTML/TokeParser/Simple.pm line 5.
Compilation failed in require at /home/users/web/b1758/sl.jskeene/public_html/cgi-bin/CWAcoordsweb.cgi line 367.
BEGIN failed--compilation aborted at /home/users/web/b1758/sl.jskeene/public_html/cgi-bin/CWAcoordsweb.cgi line 367.
I have the token.pm module installed in the HTML directory along with all the other necessary modules, so I don't know what's wrong.
I know it may be difficult for you to diagnose...but any hints of what's up? Thanks so much,
Shad
KevinADC
02-13-2008, 06:11 AM
looks like you need to add the Token.pm module into the HTML/TokeParser/Simple/ folder.
nkrgupta
02-13-2008, 06:35 AM
looks like you need to add the Token.pm module into the HTML/TokeParser/Simple/ folder.
Well I just downloaded the HTML::TokeParser:Simple module and unzipped it as-it-was. By following the steps above, I got no errors and the module was loaded in the cgi page. However, I did not go further to use the module, or even create an object. But that should also happen smoothly once it's loaded.
Maybe it's just a path issue which shadkeene isfacing.
@shadkeene: you might want to look at the path where you are keeping the HTML directory and either include that path as use lib ('path_to_html_dir');
or
unshift it in your @INC.
shadkeene
02-13-2008, 10:30 PM
Thanks everyone for the help...I believe its working now...just had to follow the error messages and create the necessary folders...structure went as far as having HTML/TokeParser/Simple/Token/Tag folder.
Thanks again,
Shad
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.