Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Perl / July 2005



Tip: Looking for answers? Try searching our database.

How to Install Modules Locally?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lola Lee - 15 Jul 2005 02:06 GMT
I usually install modules via cpan, but I've been sent a module to test.
 I usually install modules via CPAN.  I've been googling installing
modules locally to see how it works.  From what I've found, it seems
simple enough to do something like this:

% perl5 Makefile.PL
% make
% make test
% make install
% make clean

Are there any gotchas?  How do I make sure this module gets installed
into the right directory - ~/.cpan/build?

Signature

Lola - mailto:lola@his.com
http://www.lolajl.net | Blog at http://www.lolajl.net/blog/
Terrorismus delendus est! (Terrorism must be destroyed utterly!)
I'm in Bowie, MD, USA, halfway between DC and Annapolis.

Sherm Pendley - 15 Jul 2005 07:06 GMT
> I usually install modules via cpan, but I've been sent a module to  
> test.  I usually install modules via CPAN.  I've been googling  
> installing modules locally to see how it works.  From what I've  
> found, it seems simple enough to do something like this:
>
> % perl5 Makefile.PL

Why "perl5"? Do you also have "perl4" installed? :-\

If you want to install under a specific Perl, spell out the full  
location, including the path, and pay close attention to the output  
of the next steps to ensure that it's used. For instance:

    /usr/local/bin/perl5.8.7 Makefile.PL

> % make
> % make test
> % make install

The above will attempt to install the module in the standard location  
- i.e. for the built-in Perl, in /Library/Perl/5.8.6 (for Tiger).

If your system is configured correctly, with no permissions gone  
awry, it will fail, because /Library/Perl and everything under it  
should only be writable by root. For it to succeed, you should use  
"sudo" to run the last step:

    sudo make install

> % make clean

You don't need to do that.

> Are there any gotchas?  How do I make sure this module gets  
> installed into the right directory - ~/.cpan/build?

Um, ~/.cpan/build is *NOT* the right directory to install into. The  
~/.cpan tree is used to store temporary files used by CPAN.pm while  
downloading and installing modules - ~/.cpan/sources/ to hold  
tarballs, ~/.cpan/build/ to unzip them and run the above commands,  
etc. Once a module is finished installing, you should *NEVER* need to  
refer to the temporary copy of it that was created in ~/.cpan/build/  
as part of the build process.

As I said above, the standard location for user-installed modules for  
the built-in Perl is under /Library/Perl - for Tiger it's /Library/
Perl/5.8.6. Modules that are included with Perl - aka "core" modules  
- are found under /System/Library/Perl.

If you wish to keep a separate local directory - maybe because you  
don't have "sudo" access or don't want to use it for code that's  
still being tested - use the PREFIX option when running Makefile.PL:

    perl Makefile.PL PREFIX=~/lib

Run the other commands normally, keeping in mind that you only need  
to use "sudo" to run the install step if the directory you've  
specified needs root access to write into. In your scripts, you'll  
need to add it to the module search path with the following:

    use lib '/Users/lola/lib'; # Or whatever your user dir is...

sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
Lola Lee - 15 Jul 2005 10:10 GMT
> Why "perl5"? Do you also have "perl4" installed? :-\

Uhhh . . . no.  It's just an example.  The module I need to install is
WWW-Search - the author has removed the dependency on cat and dos2unix
and needs for me to test it on the Mac platform before uploading it to
CPAN.  Hence, the need to install it locally.

Signature

Lola - mailto:lola@his.com
http://www.lolajl.net | Blog at http://www.lolajl.net/blog/
Terrorismus delendus est! (Terrorism must be destroyed utterly!)
I'm in Bowie, MD, USA, halfway between DC and Annapolis.

Sherm Pendley - 15 Jul 2005 11:16 GMT
> The module I need to install is WWW-Search - the author has removed  
> the dependency on cat and dos2unix and needs for me to test it on  
> the Mac platform before uploading it to CPAN.  Hence, the need to  
> install it locally.

I'm still not 100% certain what you mean by "install it locally". The  
CPAN shell is a convenient way to automate a task that quickly grows  
repetitive and boring without it, but that's all it is. It's not  
doing any special "magic", just using the system() function to run  
the same commands you'd run by hand.

Are you concerned about where to unzip it to before running the "perl  
Makefile.PL; make; make test; sudo make install" commands? That  
doesn't matter, within reason at least - don't do something silly  
like unzipping it directly into the directory it will be installed  
in. You want to use a location that's safely out of the way so it  
doesn't interfere with other stuff, and isolated enough so that you  
can easily delete it when you're done.

Some folks create a subdirectory under /tmp, others use ~/tmp. For  
myself, I use ~/build, for no particular reason. The CPAN shell uses  
~/.cpan/build by default, but there's nothing particularly special  
about that choice. In fact, I avoid using that for manual installs,  
simply to minimize the risk of confusing the CPAN shell with  
"foreign" files that it didn't create. My concern on that score is  
probably entirely unwarranted, but I subscribe to the "better safe  
than sorry" school of thought.

sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
Lola Lee - 15 Jul 2005 11:27 GMT
> I'm still not 100% certain what you mean by "install it locally". The  
> CPAN shell is a convenient way to automate a task that quickly grows  

The author sent me the files, all zipped up, instead of posting it to
CPAN.

> Are you concerned about where to unzip it to before running the "perl  
> Makefile.PL; make; make test; sudo make install" commands? That  doesn't
> matter, within reason at least - don't do something silly  like
> unzipping it directly into the directory it will be installed  in. You

Yes, that is what I meant.

> Some folks create a subdirectory under /tmp, others use ~/tmp. For  
> myself, I use ~/build, for no particular reason. The CPAN shell uses  
> ~/.cpan/build by default, but there's nothing particularly special  
> about that choice. In fact, I avoid using that for manual installs,  

Just what I needed - will take the same precautions.

Signature

Lola - mailto:lola@his.com
http://www.lolajl.net | Blog at http://www.lolajl.net/blog/
Terrorismus delendus est! (Terrorism must be destroyed utterly!)
I'm in Bowie, MD, USA, halfway between DC and Annapolis.

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.