Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

use lib functionality

by Anonymous Monk
on Jun 15, 2007 at 18:38 UTC ( [id://621497]=perlquestion: print w/replies, xml ) Need Help??

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

hi, do you have to install all perl modules even if they don't need some c compiling? if the perl module is strictly just source, can I use the "use lib" function to use the module? what are the differences of just uploading a module vs. installing one?

Replies are listed 'Best First'.
Re: use lib functionality
by derby (Abbot) on Jun 15, 2007 at 19:07 UTC

    all the use lib pragma does is manipulate @INC at compile time to expose modules (whether pure perl or not) that are not in the *standard* locations.

    So no, there's really no difference and yes, you can use the use lib pragma to *use* a module.

    -derby
Re: use lib functionality
by runrig (Abbot) on Jun 15, 2007 at 18:53 UTC
    Is there any reason you can't install it (to a different directory than the usual place perhaps -- there are options to do that)? If it is a standalone pm file, then no it doesn't have to be "installed", but if you do go through the 'make, make test, make install', then you get the benefits of knowing that it was tested, and also the Makefile might do some other setup (but probably not, YMMV).
Re: use lib functionality
by Praveen (Friar) on Jun 15, 2007 at 19:28 UTC
    Hi,

    This Module simplifies the manipulation of @INC at compile time.

    Using "use lib" you can add your own library path

    It is used to add extra directories to perl's library search path

    @INC contains a list of directories from which Perl modules and libraries can be loaded.
Re: use lib functionality
by Anonymous Monk on Jun 15, 2007 at 19:36 UTC
    hi, k i think i'm starting to see the point. :)

    i think my question should have been, is there any difference in uploading a module straight to a path vs. installing a module via the makefile.

    i also took a deeper look into the install file of cgi::session and it says the makefile process will do some permission changing...and from what i can tell it just chmod's the files to 755.

    thanks every1. i think i'll be all set now.
      With Perl modules that are only Perl code, it is usually OK. When in doubt, try it.

      Of special note are modules that say they are pure-Perl. This means that the module is a replacement for a module using C, XS, or something similar, so it is often intended to be uploaded without installing.

      My host won't install modules the right way so I have to upload them myself. I've got CGI::Session with only uploading it in a custom lib. But somehow, when using the File driver for session storage I was running into errors. But I'm almost sure it had something to do with running my website under mod_perl and not plain CGI. PS: Don't forget to clean your sessions when they expire :-).
      Recent versions of CGI::Session use a recent version of Scalar::Utils.

      If your hoster doesn't have the appropriate S::U you'll run into the sort of problems Htbaa mentions. I had similar problems myself.

Re: use lib functionality
by Anonymous Monk on Jun 15, 2007 at 18:47 UTC
    also, i plan on using cgi::session...since i don't want to have it installed, i'm going to be using this module through use lib......reason why i can't have it installed is my host (reseller) will be gone for 3 days...and i really want to start playing with it now. is there even a difference?
Re: use lib functionality
by Cap'n Steve (Friar) on Jun 17, 2007 at 01:22 UTC
    Like everyone else said, it will work for most modules. I didn't even find out about ppm until a year or two after I learned Perl.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-04-24 22:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found