|
|
|
|
|
|
| Author |
Message |
ro.naldfi.scher@gmail.com *nix forums beginner
Joined: 24 Oct 2005
Posts: 28
|
Posted: Mon Jul 17, 2006 10:11 am Post subject:
Re: CPAN module local installation question
|
|
|
Sherm Pendley schrieb:
| Quote: | ro.naldfi.scher@gmail.com writes:
Imagine that site_perl/ is on a network-mounted volume, and accessible from
a variety of machine types all running different versions of Perl. You could
still use a single 'use lib' statement in a script that needs to run on all
those machines, and Perl would sort out which module each machine needed to
load.
|
I understand. This makes sense indeed.
| Quote: | But to require that the library path needs to be specified down to the
site_perl directory, seems to be such an arbitrary decision, that I
suspect this is a bug in Perl
Suspecting that anything for which you don't understand the rationale must
be bug seems quite arrogant to me.
|
Point taken, especially as I see now that the decision was not
arbitrary at all (though hard to guess without explanation:-)
So maybe the only thing which should be done is to correct the
installation
instructions on CPAN, so that people know how to write a correct use
lib
for those cases where modules are not installed in the default
locations.
Ronald |
|
| Back to top |
|
 |
Sherm Pendley *nix forums Guru
Joined: 03 Mar 2005
Posts: 527
|
Posted: Thu Jul 13, 2006 2:50 pm Post subject:
Re: CPAN module local installation question
|
|
|
ro.naldfi.scher@gmail.com writes:
| Quote: | Sherm Pendley schrieb:
Ronald Fischer <ronaldf@eml.cc> writes:
$ perl -e 'use lib "/tmp/foo"; use List::MoreUtils;'
Can't locate List/MoreUtils.pm in @INC (@INC contains: /tmp/foo
/usr/local/perl5.8.3/lib/5.8.3/i686-linux
/usr/local/perl5.8.3/lib/5.8.3
/usr/local/perl5.8.3/lib/site_perl/5.8.3/i686-linux
/usr/local/perl5.8.3/lib/site_perl/5.8.3
/usr/local/perl5.8.3/lib/site_perl .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
Of course if I do the test in the following way:
perl -e 'use lib "/tmp/foo/lib/site_perl/5.8.3/i686-linux"; use
List::MoreUtils;'
it works, but from what the CPAN documentation site suggests, it
should be sufficient to specify in @INC the parent of the lib directory.
You should be able to "use lib '/tmp/foo/lib/site_perl';" - the version
and architecture directory should be added automagically by the lib pragma.
It is correct, that *this* works, while, for example, "use lib
'/tmp/foo/lib" is
not sufficient.
Given that the complete path to the module is
/tmp/foo/lib/site_perl/5.8.3/i686-linux/List/MoreUtils.pm
I wonder how the search algorithm of "use lib" is implemente, that it
can find
the directory "List" two levels down from site_perl, but not three
levels down
from lib.
|
It's not really searching at all. First it checks to see if the specified
directory exists, and if so adds it to @INC. Then it appends the version
number of the currently-running Perl, and repeats, and then again with the
architecture.
Imagine that site_perl/ is on a network-mounted volume, and accessible from
a variety of machine types all running different versions of Perl. You could
still use a single 'use lib' statement in a script that needs to run on all
those machines, and Perl would sort out which module each machine needed to
load.
| Quote: | understand a design decision which states that the lib directory needs
to be stated (because the layout below lib is kind of "known structure"
to perl)
|
The layout below lib is *not* a known structure, it's just the default. The
only known structure is the version/arch subdirectories. On Mac OS X, for
instance, CPAN modules are found in /Library/Perl.
| Quote: | But to require that the library path needs to be specified down to the
site_perl directory, seems to be such an arbitrary decision, that I
suspect this is a bug in Perl
|
Suspecting that anything for which you don't understand the rationale must
be bug seems quite arrogant to me.
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net |
|
| Back to top |
|
 |
ro.naldfi.scher@gmail.com *nix forums beginner
Joined: 24 Oct 2005
Posts: 28
|
Posted: Thu Jul 13, 2006 7:40 am Post subject:
Re: CPAN module local installation question
|
|
|
Sherm Pendley schrieb:
| Quote: | Ronald Fischer <ronaldf@eml.cc> writes:
$ perl -e 'use lib "/tmp/foo"; use List::MoreUtils;'
Can't locate List/MoreUtils.pm in @INC (@INC contains: /tmp/foo
/usr/local/perl5.8.3/lib/5.8.3/i686-linux
/usr/local/perl5.8.3/lib/5.8.3
/usr/local/perl5.8.3/lib/site_perl/5.8.3/i686-linux
/usr/local/perl5.8.3/lib/site_perl/5.8.3
/usr/local/perl5.8.3/lib/site_perl .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
Of course if I do the test in the following way:
perl -e 'use lib "/tmp/foo/lib/site_perl/5.8.3/i686-linux"; use
List::MoreUtils;'
it works, but from what the CPAN documentation site suggests, it
should be sufficient to specify in @INC the parent of the lib directory.
You should be able to "use lib '/tmp/foo/lib/site_perl';" - the version
and architecture directory should be added automagically by the lib pragma.
|
It is correct, that *this* works, while, for example, "use lib
'/tmp/foo/lib" is
not sufficient.
Given that the complete path to the module is
/tmp/foo/lib/site_perl/5.8.3/i686-linux/List/MoreUtils.pm
I wonder how the search algorithm of "use lib" is implemente, that it
can find
the directory "List" two levels down from site_perl, but not three
levels down
from lib.
I could understand if the implementors of Perl require the search path
to list
extensively all directories explicitly, which can contain modules
( /tmp/foo/lib/site_perl/5.8.3/i686-linux in my example). I could also
understand a design decision which states that the lib directory needs
to be stated (because the layout below lib is kind of "known structure"
to perl), i.e. that use lib "/tmp/foo/lib" or even /tmp/foo would be
sufficient.
But to require that the library path needs to be specified down to the
site_perl directory, seems to be such an arbitrary decision, that I
suspect
this is a bug in Perl (in the sense that it is not what the implementor
originally had intended).
Now if we just could get an authoritative response to this question...
Ronald |
|
| Back to top |
|
 |
Mumia W. *nix forums Guru Wannabe
Joined: 08 May 2006
Posts: 153
|
Posted: Wed Jul 12, 2006 7:14 pm Post subject:
Re: CPAN module local installation question
|
|
|
On 07/12/2006 07:07 AM, Mumia W. wrote:
| Quote: | On 07/12/2006 04:59 AM, Stephan Titard wrote:
Ronald Fischer escribió:
It's the first time that I am doing a *local* install of a CPAN
module, and promptly stumbled over a problem:
Using /tmp/foo as a destination directory for playing around,
Following the documentation on
http://search.cpan.org/~jhi/perl-5.8.0/pod/perlmodinstall.pod)
(I mention this because, as you will see below, it might be
that this documentation is incorrect about local installation),
I did:
perl Makefile.PL PREFIX=/tmp/foo
make
make install
which worked fine and produced, as expected:
$ du /tmp/foo
68 /tmp/foo/lib/site_perl/5.8.3/i686-linux/auto/List/MoreUtils
72 /tmp/foo/lib/site_perl/5.8.3/i686-linux/auto/List
76 /tmp/foo/lib/site_perl/5.8.3/i686-linux/auto
24 /tmp/foo/lib/site_perl/5.8.3/i686-linux/List
104 /tmp/foo/lib/site_perl/5.8.3/i686-linux
108 /tmp/foo/lib/site_perl/5.8.3
112 /tmp/foo/lib/site_perl
8 /tmp/foo/lib/5.8.3/i686-linux
12 /tmp/foo/lib/5.8.3
128 /tmp/foo/lib
28 /tmp/foo/man/man3
32 /tmp/foo/man
164 /tmp/foo
Also, the module was installed at the expected place:
$ find /tmp/foo -name '*pm'
/tmp/foo/lib/site_perl/5.8.3/i686-linux/List/MoreUtils.pm
Now the aforementioned CPAN page says:
'Type
perl Makefile.PL PREFIX=/my/perl_directory
to install it locally. (Remember that if you do this, you'll have to
put use lib "/my/perl_directory"; near the top of the program that is
to use this module.'
So I tried the following to test my installation:
$ perl -e 'use lib "/tmp/foo"; use List::MoreUtils;'
Can't locate List/MoreUtils.pm in @INC (@INC contains: /tmp/foo
/usr/local/perl5.8.3/lib/5.8.3/i686-linux
/usr/local/perl5.8.3/lib/5.8.3
/usr/local/perl5.8.3/lib/site_perl/5.8.3/i686-linux
/usr/local/perl5.8.3/lib/site_perl/5.8.3
/usr/local/perl5.8.3/lib/site_perl .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
Of course if I do the test in the following way:
perl -e 'use lib "/tmp/foo/lib/site_perl/5.8.3/i686-linux"; use
List::MoreUtils;'
it works, but from what the CPAN documentation site suggests, it
should be sufficient to specify in @INC the parent of the lib directory.
Did I do something wrong? Is this an error in the documentation on the
CPAN site?
Ronald
does it help to include the lib subdir too?
I mean: "/tmp/foo/lib"
--stephan
"Perldoc perlmodinstall" suggests that only /tmp/foo is necessary when,
in fact, /tmp/foo/lib is required, e.g.
$ perl -Mlib=/tmp/foo -MList::MoreUtils -e 1
fails when perlmodinstall suggests it should succeed. Instead you must
do this:
$ perl -Mlib=/tmp/foo/lib -MList::MoreUtils -e 1
|
I was wrong. This works:
$ perl -Mlib=/tmp/foo/lib/perl -MList::MoreUtils -e 1
| Quote: | IMO (in my opinion), it's a document bug in perlmodinstall.pod, but it's
not as grand as what Mr. Fischer was thinking.
|
Now I don't know what to think. For me, MoreUtils.pm
was put into a different location:
(inside /tmp/foo)
| Quote: | $ find . -name '*.pm'
./lib/perl/5.8.4/List/MoreUtils.pm
|
? |
|
| Back to top |
|
 |
Sherm Pendley *nix forums Guru
Joined: 03 Mar 2005
Posts: 527
|
Posted: Wed Jul 12, 2006 1:05 pm Post subject:
Re: CPAN module local installation question
|
|
|
Ronald Fischer <ronaldf@eml.cc> writes:
| Quote: | Also, the module was installed at the expected place:
$ find /tmp/foo -name '*pm'
/tmp/foo/lib/site_perl/5.8.3/i686-linux/List/MoreUtils.pm
Now the aforementioned CPAN page says:
'Type
perl Makefile.PL PREFIX=/my/perl_directory
to install it locally. (Remember that if you do this, you'll have to
put use lib "/my/perl_directory"; near the top of the program that is
to use this module.'
So I tried the following to test my installation:
$ perl -e 'use lib "/tmp/foo"; use List::MoreUtils;'
Can't locate List/MoreUtils.pm in @INC (@INC contains: /tmp/foo
/usr/local/perl5.8.3/lib/5.8.3/i686-linux
/usr/local/perl5.8.3/lib/5.8.3
/usr/local/perl5.8.3/lib/site_perl/5.8.3/i686-linux
/usr/local/perl5.8.3/lib/site_perl/5.8.3
/usr/local/perl5.8.3/lib/site_perl .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
Of course if I do the test in the following way:
perl -e 'use lib "/tmp/foo/lib/site_perl/5.8.3/i686-linux"; use
List::MoreUtils;'
it works, but from what the CPAN documentation site suggests, it
should be sufficient to specify in @INC the parent of the lib directory.
|
You should be able to "use lib '/tmp/foo/lib/site_perl';" - the version
and architecture directory should be added automagically by the lib pragma.
Using PREFIX changes the base directory, but doesn't change the layout of the
directories under it. That layout still makes a distinction between Core and
CPAN modules, even when you're only installing CPAN modules.
| Quote: | Did I do something wrong? Is this an error in the documentation on the
CPAN site?
|
I suppose it's technically correct, in that a module might be configured to
install in the directory for core modules. It's certainly misleading though,
and doesn't apply to the most common case.
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net |
|
| Back to top |
|
 |
Mumia W. *nix forums Guru Wannabe
Joined: 08 May 2006
Posts: 153
|
Posted: Wed Jul 12, 2006 12:07 pm Post subject:
Re: CPAN module local installation question
|
|
|
On 07/12/2006 04:59 AM, Stephan Titard wrote:
| Quote: | Ronald Fischer escribió:
It's the first time that I am doing a *local* install of a CPAN
module, and promptly stumbled over a problem:
Using /tmp/foo as a destination directory for playing around,
Following the documentation on
http://search.cpan.org/~jhi/perl-5.8.0/pod/perlmodinstall.pod)
(I mention this because, as you will see below, it might be
that this documentation is incorrect about local installation),
I did:
perl Makefile.PL PREFIX=/tmp/foo
make
make install
which worked fine and produced, as expected:
$ du /tmp/foo
68 /tmp/foo/lib/site_perl/5.8.3/i686-linux/auto/List/MoreUtils
72 /tmp/foo/lib/site_perl/5.8.3/i686-linux/auto/List
76 /tmp/foo/lib/site_perl/5.8.3/i686-linux/auto
24 /tmp/foo/lib/site_perl/5.8.3/i686-linux/List
104 /tmp/foo/lib/site_perl/5.8.3/i686-linux
108 /tmp/foo/lib/site_perl/5.8.3
112 /tmp/foo/lib/site_perl
8 /tmp/foo/lib/5.8.3/i686-linux
12 /tmp/foo/lib/5.8.3
128 /tmp/foo/lib
28 /tmp/foo/man/man3
32 /tmp/foo/man
164 /tmp/foo
Also, the module was installed at the expected place:
$ find /tmp/foo -name '*pm'
/tmp/foo/lib/site_perl/5.8.3/i686-linux/List/MoreUtils.pm
Now the aforementioned CPAN page says:
'Type
perl Makefile.PL PREFIX=/my/perl_directory
to install it locally. (Remember that if you do this, you'll have to
put use lib "/my/perl_directory"; near the top of the program that is
to use this module.'
So I tried the following to test my installation:
$ perl -e 'use lib "/tmp/foo"; use List::MoreUtils;'
Can't locate List/MoreUtils.pm in @INC (@INC contains: /tmp/foo
/usr/local/perl5.8.3/lib/5.8.3/i686-linux
/usr/local/perl5.8.3/lib/5.8.3
/usr/local/perl5.8.3/lib/site_perl/5.8.3/i686-linux
/usr/local/perl5.8.3/lib/site_perl/5.8.3
/usr/local/perl5.8.3/lib/site_perl .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
Of course if I do the test in the following way:
perl -e 'use lib "/tmp/foo/lib/site_perl/5.8.3/i686-linux"; use
List::MoreUtils;'
it works, but from what the CPAN documentation site suggests, it
should be sufficient to specify in @INC the parent of the lib directory.
Did I do something wrong? Is this an error in the documentation on the
CPAN site?
Ronald
does it help to include the lib subdir too?
I mean: "/tmp/foo/lib"
--stephan
|
"Perldoc perlmodinstall" suggests that only /tmp/foo is
necessary when, in fact, /tmp/foo/lib is required, e.g.
$ perl -Mlib=/tmp/foo -MList::MoreUtils -e 1
fails when perlmodinstall suggests it should succeed.
Instead you must do this:
$ perl -Mlib=/tmp/foo/lib -MList::MoreUtils -e 1
IMO (in my opinion), it's a document bug in
perlmodinstall.pod, but it's not as grand as what Mr.
Fischer was thinking. |
|
| Back to top |
|
 |
ro.naldfi.scher@gmail.com *nix forums beginner
Joined: 24 Oct 2005
Posts: 28
|
Posted: Wed Jul 12, 2006 10:36 am Post subject:
Re: CPAN module local installation question
|
|
|
Stephan Titard schrieb:
| Quote: | Ronald Fischer escribió:
$ perl -e 'use lib "/tmp/foo"; use List::MoreUtils;'
Can't locate List/MoreUtils.pm in @INC (@INC contains: /tmp/foo
/usr/local/perl5.8.3/lib/5.8.3/i686-linux /usr/local/perl5.8.3/lib/5.8.3
/usr/local/perl5.8.3/lib/site_perl/5.8.3/i686-linux
/usr/local/perl5.8.3/lib/site_perl/5.8.3
/usr/local/perl5.8.3/lib/site_perl .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
Of course if I do the test in the following way:
perl -e 'use lib "/tmp/foo/lib/site_perl/5.8.3/i686-linux"; use
List::MoreUtils;'
it works, but from what the CPAN documentation site suggests, it
should be sufficient to specify in @INC the parent of the lib directory.
does it help to include the lib subdir too?
I mean: "/tmp/foo/lib"
|
No, doesn't work either.
Interestingly, @INC also contains by defaul not, say,
/usr/local/perl5.8.3,
put lists all its subdirectories explitily.
Ronald |
|
| Back to top |
|
 |
Stephan Titard *nix forums beginner
Joined: 27 Oct 2005
Posts: 17
|
Posted: Wed Jul 12, 2006 9:59 am Post subject:
Re: CPAN module local installation question
|
|
|
Ronald Fischer escribió:
| Quote: | It's the first time that I am doing a *local* install of a CPAN
module, and promptly stumbled over a problem:
Using /tmp/foo as a destination directory for playing around,
Following the documentation on
http://search.cpan.org/~jhi/perl-5.8.0/pod/perlmodinstall.pod)
(I mention this because, as you will see below, it might be
that this documentation is incorrect about local installation),
I did:
perl Makefile.PL PREFIX=/tmp/foo
make
make install
which worked fine and produced, as expected:
$ du /tmp/foo
68 /tmp/foo/lib/site_perl/5.8.3/i686-linux/auto/List/MoreUtils
72 /tmp/foo/lib/site_perl/5.8.3/i686-linux/auto/List
76 /tmp/foo/lib/site_perl/5.8.3/i686-linux/auto
24 /tmp/foo/lib/site_perl/5.8.3/i686-linux/List
104 /tmp/foo/lib/site_perl/5.8.3/i686-linux
108 /tmp/foo/lib/site_perl/5.8.3
112 /tmp/foo/lib/site_perl
8 /tmp/foo/lib/5.8.3/i686-linux
12 /tmp/foo/lib/5.8.3
128 /tmp/foo/lib
28 /tmp/foo/man/man3
32 /tmp/foo/man
164 /tmp/foo
Also, the module was installed at the expected place:
$ find /tmp/foo -name '*pm'
/tmp/foo/lib/site_perl/5.8.3/i686-linux/List/MoreUtils.pm
Now the aforementioned CPAN page says:
'Type
perl Makefile.PL PREFIX=/my/perl_directory
to install it locally. (Remember that if you do this, you'll have to put
use lib "/my/perl_directory"; near the top of the program that is to use
this module.'
So I tried the following to test my installation:
$ perl -e 'use lib "/tmp/foo"; use List::MoreUtils;'
Can't locate List/MoreUtils.pm in @INC (@INC contains: /tmp/foo
/usr/local/perl5.8.3/lib/5.8.3/i686-linux /usr/local/perl5.8.3/lib/5.8.3
/usr/local/perl5.8.3/lib/site_perl/5.8.3/i686-linux
/usr/local/perl5.8.3/lib/site_perl/5.8.3
/usr/local/perl5.8.3/lib/site_perl .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
Of course if I do the test in the following way:
perl -e 'use lib "/tmp/foo/lib/site_perl/5.8.3/i686-linux"; use
List::MoreUtils;'
it works, but from what the CPAN documentation site suggests, it
should be sufficient to specify in @INC the parent of the lib directory.
Did I do something wrong? Is this an error in the documentation on the
CPAN site?
Ronald
does it help to include the lib subdir too? |
I mean: "/tmp/foo/lib"
--stephan |
|
| Back to top |
|
 |
Ronald Fischer *nix forums beginner
Joined: 21 Oct 2005
Posts: 14
|
Posted: Wed Jul 12, 2006 8:49 am Post subject:
CPAN module local installation question
|
|
|
It's the first time that I am doing a *local* install of a CPAN
module, and promptly stumbled over a problem:
Using /tmp/foo as a destination directory for playing around,
Following the documentation on
http://search.cpan.org/~jhi/perl-5.8.0/pod/perlmodinstall.pod)
(I mention this because, as you will see below, it might be
that this documentation is incorrect about local installation),
I did:
perl Makefile.PL PREFIX=/tmp/foo
make
make install
which worked fine and produced, as expected:
$ du /tmp/foo
68 /tmp/foo/lib/site_perl/5.8.3/i686-linux/auto/List/MoreUtils
72 /tmp/foo/lib/site_perl/5.8.3/i686-linux/auto/List
76 /tmp/foo/lib/site_perl/5.8.3/i686-linux/auto
24 /tmp/foo/lib/site_perl/5.8.3/i686-linux/List
104 /tmp/foo/lib/site_perl/5.8.3/i686-linux
108 /tmp/foo/lib/site_perl/5.8.3
112 /tmp/foo/lib/site_perl
8 /tmp/foo/lib/5.8.3/i686-linux
12 /tmp/foo/lib/5.8.3
128 /tmp/foo/lib
28 /tmp/foo/man/man3
32 /tmp/foo/man
164 /tmp/foo
Also, the module was installed at the expected place:
$ find /tmp/foo -name '*pm'
/tmp/foo/lib/site_perl/5.8.3/i686-linux/List/MoreUtils.pm
Now the aforementioned CPAN page says:
'Type
perl Makefile.PL PREFIX=/my/perl_directory
to install it locally. (Remember that if you do this, you'll have to put
use lib "/my/perl_directory"; near the top of the program that is to use
this module.'
So I tried the following to test my installation:
$ perl -e 'use lib "/tmp/foo"; use List::MoreUtils;'
Can't locate List/MoreUtils.pm in @INC (@INC contains: /tmp/foo
/usr/local/perl5.8.3/lib/5.8.3/i686-linux /usr/local/perl5.8.3/lib/5.8.3
/usr/local/perl5.8.3/lib/site_perl/5.8.3/i686-linux
/usr/local/perl5.8.3/lib/site_perl/5.8.3
/usr/local/perl5.8.3/lib/site_perl .) at -e line 1.
BEGIN failed--compilation aborted at -e line 1.
Of course if I do the test in the following way:
perl -e 'use lib "/tmp/foo/lib/site_perl/5.8.3/i686-linux"; use
List::MoreUtils;'
it works, but from what the CPAN documentation site suggests, it
should be sufficient to specify in @INC the parent of the lib directory.
Did I do something wrong? Is this an error in the documentation on the
CPAN site?
Ronald
--
Ronald Fischer <ronaldf@eml.cc>
Posted via http://www.newsoffice.de/ |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|
|
The time now is Sat Nov 22, 2008 8:16 am | All times are GMT
|
|
Share Prices | Web Advertising | Acer Monitors | Mortgage Calculator | Mortgage
|
|
Copyright © 2004-2005 DeniX Solutions SRL
|
|
|
|
Other DeniX Solutions sites:
Unix/Linux blog |
electronics forum |
medicine forum |
science forum |
|
|
Privacy Policy
|
Powered by phpBB © 2001, 2005 phpBB Group
|
|