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 / August 2006



Tip: Looking for answers? Try searching our database.

Perl Module Installation

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mo@versioncreative.com - 23 Aug 2006 17:27 GMT
Hi All,

Can anyone point me to a decent tutorial for installing perl modules.

The one I have downloaded is DBI-1.52.tar.gz

I am running OS X 10.4.7 and have never installed a perl module  
before. I have found various pages on the net but I don't want to  
mess things up so would like to make sure that the tutorial I am  
reading has been recommended by some experts! :)

I am also assuming that the right directory for my install is
System/Library/Perl/5.8.6/

Thankyou in advance,
Mo
Daniel T. Staal - 23 Aug 2006 17:45 GMT
On Wed, August 23, 2006 12:27 pm, Moisés Chicharro said:
> Hi All,
>
[quoted text clipped - 12 lines]
> Thankyou in advance,
> Mo

In general the best way to install Perl modules is to use CPAN.

Use Terminal and run 'perl -MCPAN -e shell' (or just 'cpan') and answer
the questions it asks.  If you don't know the answer, use the default.
Then, while in the CPAN shell, type 'install DBI'.  It will get the latest
version, unpack it, test it, and install it for you.

You will of course need the devloper tools to do this, in case you haven't
installed them already.

Daniel T. Staal

---------------------------------------------------------------
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------
mo@versioncreative.com - 24 Aug 2006 17:00 GMT
Thanks to everyone for their suggestions.

I ran the 'perl -MCPAN -e shell' and it told me to update the module  
which I did. So I now have v1.7601.

However, when trying to run 'install DBI', it piled a whole load of  
stuff into the terminal window which ended with this below ( the NOT  
OK bit is worrying me )...

-----------
test.pl done
  /usr/bin/make test -- OK
Running make install
Manifying blib/man1/dbiproxy.1
Warning: You do not have permissions to install into /usr/local/man/
man1 at /System/Library/Perl/5.8.6/ExtUtils/Install.pm line 114.
mkdir /usr/local/man/man3: Permission denied at /System/Library/Perl/
5.8.6/ExtUtils/Install.pm line 112
make: *** [pure_site_install] Error 255
  /usr/bin/make install  -- NOT OK
------------

Does that make sense to any of you guys?

Thanks again for your help :)

> On Wed, August 23, 2006 12:27 pm, Moisés Chicharro said:
>> Hi All,
[quoted text clipped - 37 lines]
> local copyright law.
> ---------------------------------------------------------------
Ted Zeng - 24 Aug 2006 17:03 GMT
I always use
Sudo
To do the installation.

In your case, I would use

sudo perl -MCPAN -e shell'

You wouldn't get those warnings if you do this.

Ted zeng

-----Original Message-----
From: Moisés Chicharro [mailto:mo@versioncreative.com]
Sent: Thursday, August 24, 2006 9:01 AM
To: macosx@perl.org
Subject: Re: Perl Module Installation

Thanks to everyone for their suggestions.

I ran the 'perl -MCPAN -e shell' and it told me to update the module  
which I did. So I now have v1.7601.

However, when trying to run 'install DBI', it piled a whole load of  
stuff into the terminal window which ended with this below ( the NOT  
OK bit is worrying me )...

-----------
test.pl done
  /usr/bin/make test -- OK
Running make install
Manifying blib/man1/dbiproxy.1
Warning: You do not have permissions to install into /usr/local/man/
man1 at /System/Library/Perl/5.8.6/ExtUtils/Install.pm line 114.
mkdir /usr/local/man/man3: Permission denied at /System/Library/Perl/
5.8.6/ExtUtils/Install.pm line 112
make: *** [pure_site_install] Error 255
  /usr/bin/make install  -- NOT OK
------------

Does that make sense to any of you guys?

Thanks again for your help :)

On 23 Aug 2006, at 17:45, Daniel T. Staal wrote:

> On Wed, August 23, 2006 12:27 pm, Moisés Chicharro said:
>> Hi All,
[quoted text clipped - 37 lines]
> local copyright law.
> ---------------------------------------------------------------
mo@versioncreative.com - 24 Aug 2006 17:23 GMT
Awesome - that seems to worked, thanks very much!!

> I always use
> Sudo
[quoted text clipped - 85 lines]
>> local copyright law.
>> ---------------------------------------------------------------
David Cantrell - 24 Aug 2006 17:03 GMT
On Thu, Aug 24, 2006 at 05:00:56PM +0100, Mois?s Chicharro wrote:

> However, when trying to run 'install DBI', it piled a whole load of  
> stuff into the terminal window which ended with this below ( the NOT  
[quoted text clipped - 14 lines]
>
> Does that make sense to any of you guys?

Yes, and it would make sense to you too if you bothered reading it.
Which part of "Warning: You do not have permissions to install into
/usr/local/man/" is so difficult to understand?

Run the CPAN shell as root as all will be well.

Signature

David Cantrell | Benevolent Dictator Of The World

 On the bright side, if sendmail is tied up routing spam and pointless
 uknot posts, it's not waving its arse around saying "root me!"
     -- Peter Corlett, in uknot

mo@versioncreative.com - 24 Aug 2006 17:57 GMT
Sorry, maybe my phrasing was misleading. Obviously I read the error  
and understood what Permission Denied means but having checked that  
my account was admin and this being the first module I have ever  
installed I was not sure what to do to get access.

Rather that writing "Does that make any sense", I should of wrote  
"How do I get round this".

> On Thu, Aug 24, 2006 at 05:00:56PM +0100, Mois?s Chicharro wrote:
>
[quoted text clipped - 22 lines]
>
> Run the CPAN shell as root as all will be well.
John Delacour - 24 Aug 2006 18:26 GMT
At 5:57 pm +0100 24/8/06, Moisés Chicharro wrote:

>Rather that writing "Does that make any sense", I should of wrote
>"How do I get round this".

sudo cpan
Password: .....

 > cpan install ...
Doug McNutt - 24 Aug 2006 18:32 GMT
>Run the CPAN shell as root as all will be well.

Idonwannadodat!

Although I have root privileges on all machines around here there are still two of use who install things and I much prefer NOT to step on the War Department's toes. She's the one who keeps my Linux OS's up to date and I rarely know whether it's Fedora or Ubuntu because I log in from OS neXt..

My solution is to use the --prefix option in ./configure to point to

--prefix $HOME/local

In $HOME/local/ there are the usual directories one of which is $HOME/local/bin/ or in some cases $HOME/perl/.  I see to it that the PERL5LIB environment variable gets set to one or the other of those. My $PATH is set to look at the $HOME/local/bin/ directory first.

The result is that I can compile and install without being root. My stuff does not get any chance to screw up something like a system update from Apple or some Linux distribution. I happily accept the responsibility for fixing things up if such an update requires changes to my stuff. My own perl modules end up in $HOME/local so there can be no accidental naming confusion.

The problem is - - - How do I tell cpan to do things that way? - especially when there is a batch of dependencies to worry about.

Signature

--> The message came to Abraham that he would beget a son. Sarah, who was behind the door, laughed. <--

John Delacour - 24 Aug 2006 19:39 GMT
>>Run the CPAN shell as root as all will be well.
>
[quoted text clipped - 9 lines]
>The problem is - - - How do I tell cpan to do things that way? -
>especially when there is a batch of dependencies to worry about.

I have never run the CPAN shell as root and I don't see what problems
you're referring to.  I just do 'sudo cpan' and everything is
installed where it should go.

Eremita:~ jd$ sudo cpan
CPAN: File::HomeDir loaded ok

cpan shell -- CPAN exploration and modules installation (v1.87)
ReadLine support enabled

cpan> install CGI
CPAN: Storable loaded ok
Going to read /Users/jd/.cpan/Metadata
  Database was generated on Thu, 24 Aug 2006 01:35:30 GMT
Running install for module CGI
...
...
All tests successful, 1 subtest skipped.
Files=18, Tests=503,  3 wallclock secs ( 1.75 cusr +  0.50 csys =  2.25 CPU)
  /usr/bin/make test -- OK
Running make install
Installing /usr/local/lib/perl5/5.8.8/CGI.pm
Installing /usr/local/lib/perl5/5.8.8/CGI/Cookie.pm
Installing /usr/local/share/man/man3/CGI.3
... etc.

cpan>
Daniel T. Staal - 24 Aug 2006 20:02 GMT
> I have never run the CPAN shell as root and I don't see what problems
> you're referring to.  I just do 'sudo cpan' and everything is
> installed where it should go.
>
> Eremita:~ jd$ sudo cpan

That's running it as root, via sudo.

I don't think it is actually all that big a deal, on your own machine, but
do be aware you are doing it.

Daniel T. Staal

---------------------------------------------------------------
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------
Doug McNutt - 24 Aug 2006 22:04 GMT
>All tests successful, 1 subtest skipped.
>Files=18, Tests=503,  3 wallclock secs ( 1.75 cusr +  0.50 csys =  2.25 CPU)
[quoted text clipped - 4 lines]
>Installing /usr/local/share/man/man3/CGI.3
>... etc.

I guess I wasn't clear. I want the modules installed in my $HOME directory so that they won't

1) Get lost when a newer OS gets installed - especially with Linux.

2) Get in the way of someone else's, the main geek - my wife's, idea of what should be there.

Installation in /usr/local gets me into trouble. $HOME/local/bin and the like is what I want cpan to use for me. Just downloading source and doing any required makes myself seems to work OK except that dependencies get to be a PITA. When the module is all perl code there is really nothing to "make" anyway and I can just reload my $HOME directory from a backup.
Signature


--> From the U S of A, the only socialist country that refuses to admit it. <--

Packy Anderson - 25 Aug 2006 00:06 GMT
> I guess I wasn't clear. I want the modules installed in my $HOME  
> directory so that they won't
[quoted text clipped - 3 lines]
> 2) Get in the way of someone else's, the main geek - my wife's,  
> idea of what should be there.

What you're looking for is http://search.cpan.org/~andk/CPAN-1.87/lib/ 
CPAN.pm#5 :
> I am not root, how can I install a module in a personal directory?
>
[quoted text clipped - 38 lines]
> because you might accidentally remove modules that other people  
> depend on that are not using the private area.

--
Packy Anderson                                              
packy@dardan.com

La perfection est atteinte non quand il ne reste rien ‡ ajouter, mais  
quand
il ne reste rien ‡ enlever.

(You know you've achieved perfection in design, not when you have  
nothing
more to add, but when you have nothing more to take away.)

                                                 --Antoine de Saint-
Exupery
Joel Rees - 24 Aug 2006 23:59 GMT
> I have never run the CPAN shell as root

I beg to disagree ...

> and I don't see what problems you're referring to.  I just do 'sudo  
> cpan'

unless, of course, you actually do it as something like

    sudo -u myuser cpan
Daniel T. Staal - 24 Aug 2006 17:16 GMT
On Thu, August 24, 2006 12:00 pm, Moisés Chicharro said:
> Thanks to everyone for their suggestions.
>
> I ran the 'perl -MCPAN -e shell' and it told me to update the module
which I did. So I now have v1.7601.

> However, when trying to run 'install DBI', it piled a whole load of
stuff into the terminal window which ended with this below ( the NOT OK
bit is worrying me )...

> -----------
> test.pl done
>    /usr/bin/make test -- OK
> Running make install
> Manifying blib/man1/dbiproxy.1
> Warning: You do not have permissions to install into /usr/local/man/
man1 at /System/Library/Perl/5.8.6/ExtUtils/Install.pm line 114. mkdir
/usr/local/man/man3: Permission denied at /System/Library/Perl/
5.8.6/ExtUtils/Install.pm line 112
> make: *** [pure_site_install] Error 255
>    /usr/bin/make install  -- NOT OK
> ------------
>
> Does that make sense to any of you guys?

Easy sense: The important line is this: 'Warning: You do not have
permissions to install into'  It means exactly what it says: you don't
have the permissions to do that, as the user you are logged in as.
Basically only root has write permissions to those directories.

The easy thing to do is invoke cpan as root, using sudo, but there is a
better way: Have cpan invoke 'sudo' for the install itself.  This is a
fairly recent option in cpan though, so you may need to use the 'run cpan
as root' first to get that version isntalled.

Anyway, if you have the version that supports it, just enter the line
o conf make_install_make_command 'sudo make'
in the cpan shell.  It will then run 'sudo make' for the final step, and
ask you for the password to allow the install at that point.  This means
it can remind you, and that you will never run a module that _fails_ its
tests as root.  (And all the messy stuff with installing, unpacking, and
the rest are done as you, not root.)

At the moment it didn't do the install, but only because it did not have
the permissions to finish.  There were no problems with the module, from
what you've said.

Daniel T. Staal

---------------------------------------------------------------
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------
Michael Barto - 23 Aug 2006 22:25 GMT
If you have downloaded the module instead of using CPAN, look at the
file "INSTALL" in the module. If should tell you what to do:

Typically:

#./configuration
#make
#make check         <= VERY IMPORTANT!!
#make install

But using CPAN is better.

There are other issues in the MacOS X for manual installation or modules
such as where the modules are install. The manual method may put them in
/usr/local instead of in /Library. Be careful.

LogiQwest uses DBI.pm for our product which runs in Perl for multiple
Unix types. (we develop on the Mac by the way for Unix reasons with
desktops). The following link I have posted that might be useful to you
for you DBI installation. It is part of our documentation (though it is
general for Unix):

http://www.logiqwest.com/dataCenter/Demos/RunBooks/EnterpriseView/Docs/DbiDbdIns
tallation.html


But many of the other links on this page do not work.

Moisés Chicharro wrote:

> Hi All,
>
[quoted text clipped - 12 lines]
> Thankyou in advance,
> Mo

Signature

------------------------------------------------------------------------
*Michael Barto*
Software Architect

    LogiQwest Circle
LogiQwest Inc.
16458 Bolsa Chica Street, # 15
Huntington Beach, CA  92649
http://www.logiqwest.com/

           mbarto@logiqwest.com <mailto:mbarto@logiqwest.com>
Tel:  714 377 3705
Fax: 714 840 3937
Cell: 714 883 1949

*'tis a gift to be simple*
------------------------------------------------------------------------
This e-mail may contain LogiQwest proprietary information and should be
treated as confidential.

Paul McCann - 24 Aug 2006 00:46 GMT
> If you have downloaded the module instead of using CPAN, look at  
> the file "INSTALL" in the module. If should tell you what to do:
[quoted text clipped - 3 lines]
> #make check         <= VERY IMPORTANT!!
> #make install

Hmm, doesn't look very typical!! Most perl modules don't have an  
"INSTALL" file, "./configuration" will produce an error as there's no  
such file in the directory (you mean "./configure" I think, but it  
will also give an error  as it's not appropriate for a perl module),  
and you probably shouldn't be running the first three of those things  
as root...

Mo, just in case you either (a) can't get the cpan script to run  
(it's sometimes a little finicky to set up behind a proxy server, for  
example), or (b) wish to do  things by hand, here's the standard  
sequence to go through in order to install DBI.

If you have downloaded DBI-1.52.tar.gz then move it somewhere  
convenient (eg, a directory called "src" in your home directory; make  
this directory if necessary). Then

% cd ~/src
% tar zxf DBI-1.52.tar.gz
% cd DBI-1.52
% perl Makefile.PL

[[ At this stage you might get warnings about missing prerequisite  
modules; in that case you will have to install them beforehand using  
the  same procedure described here. This can cause quite a bit of  
cascading backwards if the module you're installing has a lot of  
dependencies: getting stuck in such an installation cycle will make  
you appreciate cpan (the script, not the repository). ]]

% make
% make test

[[ Then if the tests all pass...]]

% sudo make install

The last of  these will ask for your password (I'm assuming you're an  
admin user). The module will automatically be installed in the  
appropriate place on your machine. No need to manually copy anything  
anywhere.

Best of luck,
Paul
Ken Williams - 24 Aug 2006 02:14 GMT
> Typically:
>
> #./configuration
> #make
> #make check         <= VERY IMPORTANT!!
> #make install

In about 12 years of doing perl I think I've never seen an  
installation sequence that looks like that.  I think you mean:

 % perl Makefile.PL
 % make
 % make test
 % sudo make install

In recent days you might also see some modules that use Module::Build  
instead of MakeMaker, and those can have a different installation  
sequence:

 % perl Build.PL
 % ./Build
 % ./Build test
 % sudo ./Build install

Well-behaved Module::Build-based modules will provide both options.

 -Ken
Joel Rees - 25 Aug 2006 00:07 GMT
> There are other issues in the MacOS X for manual installation or  
> modules such as where the modules are install. The manual method  
> may put them in /usr/local instead of in /Library. Be careful.

'sfunny. I actually prefer to load my machine-wide modules in /usr/
local. Maybe it's just the warm fuzzies, but I prefer to avoid giving  
the installation process a chance to walk on modules the system uses.

Of course, I also refrain from updating the system perl by installing  
my own machine-wide non-system perl in /usr/local, as well. That  
allows the system update process to proceed without doing such things  
as bumping into a perl I've already updated past the version the  
system update process wants to update.

It used to be that such a course was the default when you used CPAN,  
but I haven't re-installed perl in about a half year or so.
Jeff Lowrey - 25 Aug 2006 01:16 GMT
I much prefer telling the System Administrators to install the Perl
modules I need, wherever they choose as long as I can access them.

Then I can conveniently forget that I know how to spell CPAN.

-jeff lowrey
Michael Barto - 25 Aug 2006 02:09 GMT
MacOSX has the modules installed in
"Library/Perl/darwin-thread-multi-2level". Since my development is to
use #!/usr/bin/perl, this is the default library location and is where I
have installed DBI.pm

This output should tell you what happens on MacOSX (my version is
10.4.7) with perl

perl -V
Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
 Platform:
   osname=darwin, osvers=8.0, archname=darwin-thread-multi-2level
   uname='darwin b28.apple.com 8.0 darwin kernel version 7.5.0: thu mar
3 18:48:46 pst 2005; root:xnuxnu-517.99.13.obj~1release_ppc power
macintosh powerpc '
   config_args='-ds -e -Dprefix=/usr -Dccflags=-g  -pipe  
-Dldflags=-Dman3ext=3pm -Duseithreads -Duseshrplib'
   hint=recommended, useposix=true, d_sigaction=define
   usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
   useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
   use64bitint=undef use64bitall=undef uselongdouble=undef
   usemymalloc=n, bincompat5005=undef
 Compiler:
   cc='cc', ccflags ='-g -pipe -fno-common -DPERL_DARWIN
-no-cpp-precomp -fno-strict-aliasing -I/usr/local/include',
   optimize='-Os',
   cppflags='-no-cpp-precomp -g -pipe -fno-common -DPERL_DARWIN
-no-cpp-precomp -fno-strict-aliasing -I/usr/local/include'
   ccversion='', gccversion='3.3 20030304 (Apple Computer, Inc. build
1809)', gccosandvers=''
   intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
   d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
   ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
   alignbytes=8, prototype=define
 Linker and Libraries:
   ld='env MACOSX_DEPLOYMENT_TARGET=10.3 cc', ldflags ='-L/usr/local/lib'
   libpth=/usr/local/lib /usr/lib
   libs=-ldbm -ldl -lm -lc
   perllibs=-ldl -lm -lc
   libc=/usr/lib/libc.dylib, so=dylib, useshrplib=true,
libperl=libperl.dylib
   gnulibc_version=''
 Dynamic Linking:
   dlsrc=dl_dlopen.xs, dlext=bundle, d_dlsymun=undef, ccdlflags=' '
   cccdlflags=' ', lddlflags='-bundle -undefined dynamic_lookup
-L/usr/local/lib'

Characteristics of this binary (from libperl):
 Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES
PERL_IMPLICIT_CONTEXT
 Locally applied patches:
       23953 - fix for File::Path::rmtree CAN-2004-0452 security issue
       33990 - fix for setuid perl security issues
 Built under darwin
 Compiled at Mar 20 2005 16:34:19
 @INC:
   /System/Library/Perl/5.8.6/darwin-thread-multi-2level
   /System/Library/Perl/5.8.6
   /Library/Perl/5.8.6/darwin-thread-multi-2level
   /Library/Perl/5.8.6
   /Library/Perl
   /Network/Library/Perl/5.8.6/darwin-thread-multi-2level
   /Network/Library/Perl/5.8.6
   /Network/Library/Perl
   /System/Library/Perl/Extras/5.8.6/darwin-thread-multi-2level
   /System/Library/Perl/Extras/5.8.6
   /Library/Perl/5.8.1/darwin-thread-multi-2level
   /Library/Perl/5.8.1

>> There are other issues in the MacOS X for manual installation or  
>> modules such as where the modules are install. The manual method  may
[quoted text clipped - 12 lines]
> It used to be that such a course was the default when you used CPAN,  
> but I haven't re-installed perl in about a half year or so.

Signature

------------------------------------------------------------------------
*Michael Barto*
Software Architect

    LogiQwest Circle
LogiQwest Inc.
16458 Bolsa Chica Street, # 15
Huntington Beach, CA  92649
http://www.logiqwest.com/

           mbarto@logiqwest.com <mailto:mbarto@logiqwest.com>
Tel:  714 377 3705
Fax: 714 840 3937
Cell: 714 883 1949

*'tis a gift to be simple*
------------------------------------------------------------------------
This e-mail may contain LogiQwest proprietary information and should be
treated as confidential.

 
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.