Ask a Question related to PERL Modules, Design and Development.
-
Ronald Fischer #1
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
[url]http://search.cpan.org/~jhi/perl-5.8.0/pod/perlmodinstall.pod[/url])
(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 [url]http://www.newsoffice.de/[/url]
Ronald Fischer Guest
-
Local installation of perl module
Hi, I need to install a perl module without root privileges. I've followed some advices found on the web: created a .cpan directory, copied... -
adding a new module to CPAN
Hi. I'm considering adding a new module to CPAN and want some feedback. The goal of the module is to support the small scripts you have to write... -
library gd-2.0.22 and CPAN installation of GD.pm
Hello everybody, I want to intall Bioperl with the CPAN of my perl5.8 on Panther (10.3.2) ; to do such a thing I need to install GD module. To... -
ANN: Digest::SHA Module on CPAN
c.l.p.m, For those of you interested in computing SHA message digests, I've just released the lastest optimized version of the Digest::SHA module... -
CPAN wrong module installation attempt
Hi, I have a problem with the CPAN installation of the new versions of my modules (Text::MagicTemplate and HTML::MagicTemplate) that I am not able... -
Stephan Titard #2
Re: CPAN module local installation question
Ronald Fischer escribió:
does it help to include the lib subdir too?> 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
>
> [url]http://search.cpan.org/~jhi/perl-5.8.0/pod/perlmodinstall.pod[/url])
>
> (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
>
>
I mean: "/tmp/foo/lib"
--stephan
Stephan Titard Guest
-
ro.naldfi.scher@gmail.com #3
Re: CPAN module local installation question
Stephan Titard schrieb:
No, doesn't work either.> Ronald Fischer escribió:> does it help to include the lib subdir too?> > $ 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.
> I mean: "/tmp/foo/lib"
Interestingly, @INC also contains by defaul not, say,
/usr/local/perl5.8.3,
put lists all its subdirectories explitily.
Ronald
ro.naldfi.scher@gmail.com Guest
-
Mumia W. #4
Re: CPAN module local installation question
On 07/12/2006 04:59 AM, Stephan Titard wrote:
"Perldoc perlmodinstall" suggests that only /tmp/foo is> Ronald Fischer escribió:> does it help to include the lib subdir too?>> 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
>>
>> [url]http://search.cpan.org/~jhi/perl-5.8.0/pod/perlmodinstall.pod[/url])
>>
>> (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
>>
>>
> I mean: "/tmp/foo/lib"
> --stephan
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.
Mumia W. Guest
-
Sherm Pendley #5
Re: CPAN module local installation question
Ronald Fischer <ronaldf@eml.cc> writes:
You should be able to "use lib '/tmp/foo/lib/site_perl';" - the version> 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.
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.
I suppose it's technically correct, in that a module might be configured to> Did I do something wrong? Is this an error in the documentation on the
> CPAN site?
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: [url]http://wv-www.net[/url]
Cocoa programming in Perl: [url]http://camelbones.sourceforge.net[/url]
Sherm Pendley Guest
-
Mumia W. #6
Re: CPAN module local installation question
On 07/12/2006 07:07 AM, Mumia W. wrote:
I was wrong. This works:> On 07/12/2006 04:59 AM, Stephan Titard wrote:>>> Ronald Fischer escribió:>> does it help to include the lib subdir too?>>> 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
>>>
>>> [url]http://search.cpan.org/~jhi/perl-5.8.0/pod/perlmodinstall.pod[/url])
>>>
>>> (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
>>>
>>>
>> 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
>
$ perl -Mlib=/tmp/foo/lib/perl -MList::MoreUtils -e 1
Now I don't know what to think. For me, MoreUtils.pm> IMO (in my opinion), it's a document bug in perlmodinstall.pod, but it's
> not as grand as what Mr. Fischer was thinking.
>
was put into a different location:
(inside /tmp/foo)?> $ find . -name '*.pm'
> ./lib/perl/5.8.4/List/MoreUtils.pm
Mumia W. Guest
-
ro.naldfi.scher@gmail.com #7
Re: CPAN module local installation question
Sherm Pendley schrieb:
It is correct, that *this* works, while, for example, "use lib> 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.
'/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
ro.naldfi.scher@gmail.com Guest
-
Sherm Pendley #8
Re: CPAN module local installation question
[email]ro.naldfi.scher@gmail.com[/email] writes:
It's not really searching at all. First it checks to see if the specified> 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.
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.
The layout below lib is *not* a known structure, it's just the default. The> 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)
only known structure is the version/arch subdirectories. On Mac OS X, for
instance, CPAN modules are found in /Library/Perl.
Suspecting that anything for which you don't understand the rationale must> 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
be bug seems quite arrogant to me.
sherm--
--
Web Hosting by West Virginians, for West Virginians: [url]http://wv-www.net[/url]
Cocoa programming in Perl: [url]http://camelbones.sourceforge.net[/url]
Sherm Pendley Guest
-
ro.naldfi.scher@gmail.com #9
Re: CPAN module local installation question
Sherm Pendley schrieb:
I understand. This makes sense indeed.> [email]ro.naldfi.scher@gmail.com[/email] 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.
Point taken, especially as I see now that the decision was not>> > 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.
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
ro.naldfi.scher@gmail.com Guest



Reply With Quote

