Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Using/Installing modules on a remote webserver

by newrisedesigns (Curate)
on May 23, 2002 at 22:30 UTC ( #168916=perlquestion: print w/replies, xml ) Need Help??

newrisedesigns has asked for the wisdom of the Perl Monks concerning the following question:

Dear monks,

I just wrote an Perl "survey script" which uses CGI.pm and XML::Simple.

The program works fine, however, when I upload it to my webserver - which is virtually hosted :( - It dies. Not gracefully, either... the browser reports that it's still "Waiting Request."

Here's the error message from the server log.

Can't locate loadable object for module XML::Parser::Expat in @INC (@I +NC contains: /usr/lib/perl5/5.6.0/i386-linux /usr/lib/perl5/5.6.0 /us +r/lib/perl5/site_perl/5.6.0/i386-linux /usr/lib/perl5/site_perl/5.6.0 + /usr/lib/perl5/site_perl .) at XML/Parser.pm line 15 Compilation failed in require at XML/Parser.pm line 15. BEGIN failed--compilation aborted at XML/Parser.pm line 27. Compilation failed in require at XML/Simple.pm line 224.

So I thought, and I remembered that I asked in the chatterbox if one could use a module, even if one doesn't have access to that machine. I was told that you could, either by simply uploading it, or putting the guts of the module in your file.

I tried uploading XML::Simple, and all its dependencies (The entire XML, LWP, and URI directories under perl/site/lib), to no avail. I also added

BEGIN{ push (@INC, "/home/httpd/vhosts/newrisedesigns.com/cgi-bin", "/home/httpd/vhosts/newrisedesigns.com/cgi-bin/XML", /home/httpd/vhosts/newrisedesigns.com/cgi-bin/XML/Parser"); }

I'd like to keep the XML component (it's how the votes are stored on the server) however, I might have to scrap it if I can't get it working. :(

I'm stuck again, and I greatly appreciate any help you are willing to offer.

John J Reiser
newrisedesigns.com

Replies are listed 'Best First'.
Re: Using/Installing modules on a remote webserver
by perrin (Chancellor) on May 23, 2002 at 22:41 UTC
    XML::Parser is an XS module, and it creates .so files when you compile it. You can't install a module requiring compilation on a remote machine you have no command-line access to, unless you can compile it locally and then upload all of the .so files too, and even then you might have to adjust the library path. If you do have command-line access, you can compile it there and install it locally. You can find instructions for doing this by searching on this site.

    Why don't you ask your ISP if they'll just install XML::Parser for you? It's a pretty common module and a reasonable thing to expect an ISP to support.

Re: Using/Installing modules on a remote webserver
by jarich (Curate) on May 24, 2002 at 00:37 UTC
    I agree with Perrin in that you should just ask your provider to provide it.

    However, another problem then arrises. How can you do this:

    BEGIN{ push (@INC, "/home/httpd/vhosts/newrisedesigns.com/cgi-bin", "/home/httpd/vhosts/newrisedesigns.com/cgi-bin/XML", /home/httpd/vhosts/newrisedesigns.com/cgi-bin/XML/Parser"); }
    in a more elegant way? Well, fortunately there's this option:
    use lib '/home/httpd/vhosts/newrisedesigns.com/cgi-bin/XML';
    Insert as many use lib '/path/to/lib/';s as you need to get your program running. Just remember that you need to use the modules in those libraries AFTER you've used those libraries. eg:
    use lib '/home/Perllibs/'; use XML::Parser;
    Oh, and Perl will helpfully use the modules in your lib directories in preference to those in the system directories. This means that if your provider is providing an ancient version of something you need, eg CGI, you can get around that by using your own more up-to-date version. Just be wary of accidently calling your modules the same names as built in Perl modules, but this is always a problem. ;)

    Good luck.

    jarich

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://168916]
Approved by mandog
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2023-06-11 01:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you go to conferences?






    Results (40 votes). Check out past polls.

    Notices?