perlquestion
Xiong
<P><B>Background:</B> I'm a solo dev; my current project is a web application. This issue concerns my local machine. My system (Ubuntu 9.10) requires <c>perl</c> to run; I suspect it figures heavily in some aspects of GNOME. Meanwhile, I wish to develop in Perl, and I downloaded many modules using <c>cpan</c>, eventually overwriting something used in the system UI and breaking it, which led to a clean OS install.
</P>
<P>A couple Monks [id://823144|suggested] that I not do that stupid thing; instead, that I install a second <c>perl</c> executable, with its own configurations and module library. <B>This makes excellent sense.</B> I wrote, "I will leave the system <c>perl</c> and its libraries alone; if I install an application that requires modules, I'll let Synaptic take care of the dependencies. I'll compile a distinct development <c>perl</c> somewhere else and use <c>cpan</c> to install whatever I like there." I felt silly for not doing this from Go.
</P>
<P>Now, I've spent a full, 24-hour day trying to do just that. I downloaded the <c>perl</c> tarball from <b>CPAN/src</b> and walked through the install -- I thought with not too much trouble, succeeding on only the second try. Then I tried to get <c>cpan</c> working so I could install modules, the object of the exercise. I have utterly failed.
</P>
<P>I have googled extensively on the topic, read docs on <c>cpan</c> itself and on <c>Module::Build</c>. I have edited <c>MyConfig.pm</c> directly and using <c>o conf init</c>. I have <c>chown</c>ed and <c>chgrp</c>ed. All I appear to have done of lasting value, through carelessly doing <c>sudo cpan</c> at one point, is to pollute my system <c>perl</c> libraries again.
</P>
<P><B>How does one install a second <c>perl</c> for development purposes?</B>
</P>
<readmore title="Details...">
<P>I have two relevant folders, <c>/lab</c> and <c>/ark</c>. I want the development <c>perl</c> to be somewhere in the <c>/lab</c> path; I'm aiming for a hashbang line of <c>#!/lab/bin/perl</c>. I'd like that <c>perl</c> to search <c>/lab/lib/perl</c> <I>only</I> and for all modules associated with development to reside in that path <I>only</I>, except for project-specific modules which I will load in project scripts with <c>use lib</c>. I want all downloaded tarballs -- <c>perl</c>, perl modules, anything of that nature -- to be stored in <c>/ark/perl</c>, where they can be backed up at leisure. I'd prefer to be able to restore from tarballed backup (at least some of) the hundreds of modules I downloaded before pressing the Big Button. (My net connection is not the best, so redownloading is not always optimum.) I do not want to touch system <c>perl</c> for any reason; for that matter, I'd as soon download any tool the install requires and install it to <c>/lab/bin</c>, although that might be excessive.
</P>
<P>I think I've got a good <c>perl</c> install along these lines but I'm not sure and don't know how to prove it. It runs a simple script, anyway. I'm pretty sure <c>cpan</c> is fubar. I've deleted all traces of the old <c>.cpan</c> folder, since I intend never to use <c>cpan</c> again to tinker with system <c>perl</c>. But I can't seem to eliminate all traces of <c>cpan</c> from both installs and start over.
</P>
<P>I'm a tryer and a reader; I don't mind hard study. But most searches for "install perl", "install cpan" presume it's the first and only install; or the pages refer to obscure systems, installing under peculiar constraints, or the text is simply way out of date. Diligent examination of docs leads me down blind alleys. Searches for "install second perl executable", "install perl for development", and so forth founder on the common nature of the words.
</P>
<P>Here's sample (abbreviated) output from <c>cpan</c> when trying to install <c>Smart::Comments</c>for the seventh time:
</P>
<c>
cpan[2]> install Smart::Comments
CPAN: Storable loaded ok (v2.18)
Going to read '/ark/cpan/Metadata'
Database was generated on Sat, 20 Feb 2010 10:45:55 GMT
Running install for module 'Smart::Comments'
CPAN: YAML loaded ok (v0.71)
Running make for C/CH/CHORNY/Smart-Comments-1.0.4.tar.gz
CPAN: Digest::SHA loaded ok (v5.48)
CPAN: Compress::Zlib loaded ok (v2.024)
Checksum for /ark/cpan/sources/authors/id/C/CH/CHORNY/Smart-Comments-1.0.4.tar.gz ok
... (much output; looks good) ...
Building Smart-Comments
CHORNY/Smart-Comments-1.0.4.tar.gz
./Build --install_base /lab/perl --install_base /lab/perl -- OK
Running Build test
t/00.load.t ................. 1/1 # Testing Smart::Comments 1.0.4
t/00.load.t ................. ok
...(many more tests, ok)...
All tests successful.
Files=24, Tests=119, 1 wallclock secs ( 0.09 usr 0.03 sys + 1.17 cusr 0.11 csys = 1.40 CPU)
Result: PASS
CHORNY/Smart-Comments-1.0.4.tar.gz
./Build test -- OK
Running Build install
Prepending /ark/cpan/build/Smart-Comments-1.0.4-Sjn7Vr/blib/arch /ark/cpan/build/Smart-Comments-1.0.4-Sjn7Vr/blib/lib to PERL5LIB for 'install'
Building Smart-Comments
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ERROR: Can't create '/usr/local/man/man3'
Do not have write permissions on '/usr/local/man/man3'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
at /usr/local/share/perl/5.10.0/Module/Build/Base.pm line 3326
CHORNY/Smart-Comments-1.0.4.tar.gz
./Build install -- NOT OK
----
You may have to su to root to install the package
(Or you may want to run something like
o conf make_install_make_command 'sudo make'
to raise your permissions.Failed during this command:
CHORNY/Smart-Comments-1.0.4.tar.gz : install NO
</c>
<P>...and we're back to the <c>cpan</c> prompt. This makes no sense to me. Okay, I've got the build taking place in <c>/ark</c>, which isn't best but it's tolerable for now.
</P>
<P>But why is <c>/usr/local/share/perl/5.10.0/Module/Build/Base.pm</c> executing? How can I force <c>cpan</c> to work only from the new dev <c>perl</c>? Why the error trying to install <c>man</c> pages? I don't mean why does it fail; those are the system <c>man</c> page folders. I mean, why is it trying to do that?
</P>
<P>Here's ~/.cpan/CPAN/MyConfig.pm:
</P>
<c>
$CPAN::Config = {
'applypatch' => q[],
'auto_commit' => q[1],
'build_cache' => q[2048],
'build_dir' => q[/ark/cpan/build],
'build_dir_reuse' => q[0],
'build_requires_install_policy' => q[yes],
'bzip2' => q[/bin/bzip2],
'cache_metadata' => q[1],
'check_sigs' => q[0],
'colorize_debug' => q[black on_white],
'colorize_output' => q[1],
'colorize_print' => q[black],
'colorize_warn' => q[bold red on_white],
'commandnumber_in_prompt' => q[1],
'connect_to_internet_ok' => q[1],
'cpan_home' => q[/ark/cpan],
'curl' => q[/usr/bin/curl],
'ftp' => q[/usr/bin/ftp],
'ftp_passive' => q[1],
'ftp_proxy' => q[],
'getcwd' => q[cwd],
'gpg' => q[/usr/bin/gpg],
'gzip' => q[/bin/gzip],
'halt_on_failure' => q[0],
'histfile' => q[/ark/cpan/histfile],
'histsize' => q[1000],
'http_proxy' => q[],
'inactivity_timeout' => q[0],
'index_expire' => q[1],
'inhibit_startup_message' => q[0],
'keep_source_where' => q[/ark/cpan/sources],
'load_module_verbosity' => q[v],
'lynx' => q[],
'make' => q[/usr/bin/make],
'make_arg' => q[],
'make_install_arg' => q[],
'make_install_make_command' => q[/usr/bin/make],
'makepl_arg' => q[LIB=/lab/perl/lib INSTALLMAN1DIR=/lab/perl/man/man1 INSTALLMAN3DIR=/lab/perl/man/man3 INSTALLSCRIPT=/lab/bin INSTALLBIN=/lab/bin],
'mbuild_arg' => q[--install_base /lab/perl],
'mbuild_install_arg' => q[],
'mbuild_install_build_command' => q[./Build],
'mbuildpl_arg' => q[--lib=/lab/perl/lib --installman1dir=/lab/perl/man/man1 --installman3dir=/lab/perl/man/man3 --installscript=/lab/bin --installbin=/lab/bin],
'ncftp' => q[],
'ncftpget' => q[],
'no_proxy' => q[],
'pager' => q[/usr/bin/less],
'patch' => q[/usr/bin/patch],
'perl5lib_verbosity' => q[v],
'prefer_installer' => q[MB],
'prefs_dir' => q[/ark/cpan/prefs],
'prerequisites_policy' => q[follow],
'scan_cache' => q[atstart],
'shell' => q[/bin/bash],
'show_unparsable_versions' => q[0],
'show_upload_date' => q[0],
'show_zero_versions' => q[0],
'tar' => q[/bin/tar],
'tar_verbosity' => q[v],
'term_is_latin' => q[1],
'term_ornaments' => q[1],
'test_report' => q[0],
'trust_test_report_history' => q[0],
'unzip' => q[/usr/bin/unzip],
'urllist' => [q[ftp://cpan-sj.viaverio.com/pub/CPAN/], q[ftp://cpan.erlbaum.net/CPAN/], q[ftp://cpan.hexten.net/], q[ftp://cpan.llarian.net/pub/CPAN/], q[ftp://cpan.mirrors.tds.net/pub/CPAN], q[ftp://cpan.netnitco.net/pub/mirrors/CPAN/], q[ftp://cpan.pair.com/pub/CPAN/], q[ftp://cpan.uchicago.edu/pub/CPAN/], q[ftp://ftp-mirror.internap.com/pub/CPAN/], q[ftp://ftp.cise.ufl.edu/pub/mirrors/CPAN/], q[ftp://ftp.epix.net/pub/languages/perl/], q[ftp://ftp.ncsu.edu/pub/mirror/CPAN/], q[ftp://ftp.ndlug.nd.edu/pub/perl/], q[ftp://ftp.osuosl.org/pub/CPAN/], q[ftp://ftp.uwsg.iu.edu/pub/perl/CPAN/]],
'use_sqlite' => q[0],
'wget' => q[/usr/bin/wget],
'yaml_load_code' => q[0],
'yaml_module' => q[YAML],
};
1;
__END__
</c>
<P>Near as I can tell, I've specified where I want the dev module <c>man</c> pages; but those settings aren't respected. (The wrong <c>Build.PL</c>?)
</P>
</readmore>
<P>I have a sneaking feeling that I'm missing some critical piece of information, something that prevents my report here from being comprehensive. If I'm told what to look for, I'll add it.
</P>
<P>I'm prepared to set fire to the entire current install if I must but obviously, I'd be most grateful++ to the least intensive solution.
</P>
<P><B>Update:</B> Thanks to all for replies.
</P>
<P>[ikegami] suggests one <c>perl</c>, two module libraries. That's a thought but I'd like to build dev <c>perl</c> with debugging and threading support. I think [id://753430|753430] is a good pointer, though, to installing <c>cpan</c> in my case; thank you.
</P>
<P>[AriSoft]'s virtual computer approach may be above my level of expertise.
</P>
<c>$ /lab/bin/perl -V</c>
<readmore title="Output">
<c>
Summary of my perl5 (revision 5 version 10 subversion 1) configuration:
Platform:
osname=linux, osvers=2.6.31-19-generic, archname=i686-linux
uname='linux oz 2.6.31-19-generic #56-ubuntu smp thu jan 28 01:26:53 utc 2010 i686 gnulinux '
config_args=''
hint=recommended, useposix=true, d_sigaction=define
useithreads=undef, usemultiplicity=undef
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=undef, use64bitall=undef, uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2 -g',
cppflags='-DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
ccversion='', gccversion='4.4.1', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -fstack-protector -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib /usr/lib64
libs=-lnsl -ldl -lm -lcrypt -lutil -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
libc=/lib/libc-2.10.1.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.10.1'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
cccdlflags='-fPIC', lddlflags='-shared -O2 -g -L/usr/local/lib -fstack-protector'
Characteristics of this binary (from libperl):
Compile-time options: DEBUGGING PERL_DONT_CREATE_GVSV PERL_MALLOC_WRAP
USE_FAST_STDIO USE_LARGE_FILES USE_PERLIO
Built under linux
Compiled at Feb 20 2010 06:21:34
@INC:
/lab/lib/perl5/5.10.1
/lab/lib/perl5/5.10.1
.
</c>
</readmore>
<P>Thanks [redgreen]! I think <c>./Configure -Dprefix=/lab</c> leads the right way. I can study available options for that, too.
</P>
<P><B>More:</B>
</P>
<P>[JavaFan] gets ++ for somewhat more detail. I don't need Daddy to hold my hand when I go p-p but a firm, friendly grip on my arm when I totter (dodder?) is highly welcome.
</P>
<P>Upvoted [Corion] for seeing my perspective. My plan is to let all system components strictly alone, unless I <I>mean</I> to tinker with them. I'll play Engineer on remotehost; I may even rm its system <c>perl</c> and install a duplicate of my lab <c>perl</c> there. That should streamline things. If not, <plug>x10hosting.com tech support is extremely responsive.</plug>.
</P>