<br><br><div><span class="gmail_quote">On 2/17/07, <b class="gmail_sendername">David Alban</b> <<a href="mailto:extasia@extasia.org">extasia@extasia.org</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
FYI, this didn't work:<br><br> perl Makefile.PL PREFIX=/usr/local/FOO<br><br>That is, using PREFIX=/usr/local/FOO didn't cause a cpan module to be<br>installed in the /usr/local/FOO tree such that I could include it
<br>with:<br><br> use lib "/usr/local/FOO/lib/perl";<br> use Some::Module;</blockquote><div><br>You don't need to include it as "/usr/local/FOO/lib/perl". If you use PREFIX just use that same value for 'use lib', ie:
<br><br> $ perl Makefile.PL PREFIX /usr/local/FOO<br> ... <br> $ cat yourprog.pl<br> #!/usr/bin/perl -w<br><br> use lib qw(/usr/local/FOO);<br> ...<br><br>'lib' knows how to find your modules.<br><br>Garth<br>
</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">But this does work (/usr/local/FOO/lib/perl is a symlink to perl5):<br><br> perl
Makefile.PL LIB=/usr/local/FOO/perl5<br><br>It caused, for example, Crypt::PasswdMD5 to be installed as:<br><br> /usr/local/FOO/lib/perl5/Crypt/PasswdMD5.pm<br><br>Which is the same location I'm putting home grown modules.
<br><br>So now I have a single:<br><br> use lib "/usr/local/FOO/lib/perl";<br><br>statement that works both for home grown and installed-from-cpan modules.<br><br>Yay!<br><br>On 1/29/07, David Alban <<a href="mailto:extasia@extasia.org">
extasia@extasia.org</a>> wrote:<br>> (Assume I'm not allowed to update the "live" perl installation, so I'm<br>> installing modules in the /usr/local/FOO tree.) I have:<br>><br>> $ find /usr/local/FOO/lib/perl5 -type f
<br>> /usr/local/FOO/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/auto/Crypt/PasswdMD5/.packlist<br>> /usr/local/FOO/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi/perllocal.pod<br>> /usr/local/FOO/lib/perl5/site_perl/5.8.0/Crypt/PasswdMD5.pm
<br>> /usr/local/FOO/lib/perl5/Log/Transcript.pm<br>><br>> Crypt::PasswdMD5 is from CPAN. I took Garth's suggestion and did:<br>><br>> $ perl Makefile.PL PREFIX=/usr/local/FOO<br>><br>> and the files were installed as shown above. Log::Transcript is the
<br>> module I wrote.<br>><br>> Ideally, I'd like to have users be able to include a single "use ..."<br>> statement in the code.[1] I'd like it to be:<br>><br>> use lib "/usr/local/FOO/lib/perl5";
<br>> # or /usr/local/FOO/lib/perl if I make the latter a symlink to<br>> the former<br>><br>> Not two:<br>><br>> use lib "/usr/local/FOO/lib/perl5";<br>> use lib "/usr/local/FOO/lib/perl5/site_perl";
<br>><br>> Based on Quinn's suggestion, I thought the former might allow a<br>> program to pick up both Log::Transcript (or, home-grown modules) and<br>> Crypt::PasswdMD5 (or, cpan installed modules). But it doesn't pick up
<br>> the site_perl tree:<br>><br>> $ unset PERL5LIB; perl -I/usr/local/FOO/lib/perl5 -MCrypt::PasswdMD5 -e 1<br>> Can't locate Crypt/PasswdMD5.pm in @INC (@INC contains:<br>> /usr/local/FOO/lib/perl5/5.8.0/i386-linux-thread-multi
<br>> /usr/local/FOO/lib/perl5/5.8.0 /usr/local/FOO/lib/perl5<br>> /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0<br>> /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi<br>> /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl
<br>> /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi<br>> /usr/lib/perl5/vendor_perl/5.8.0 /usr/lib/perl5/vendor_perl<br>> /usr/lib/perl5/5.8.0/i386-linux-thread-multi /usr/lib/perl5/5.8.0 .).<br>> BEGIN failed--compilation aborted.
<br>><br>> It's a little clearer here:<br>><br>> $ unset PERL5LIB; perl -I/usr/local/FOO/lib/perl5 -e 'print join "\n", @INC'<br>> /usr/local/FOO/lib/perl5/5.8.0/i386-linux-thread-multi
<br>> /usr/local/FOO/lib/perl5/5.8.0<br>> /usr/local/FOO/lib/perl5<br>> /usr/lib/perl5/5.8.0/i386-linux-thread-multi<br>> /usr/lib/perl5/5.8.0<br>> /usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi<br>
> /usr/lib/perl5/site_perl/5.8.0<br>> /usr/lib/perl5/site_perl<br>> /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi<br>> /usr/lib/perl5/vendor_perl/5.8.0<br>> /usr/lib/perl5/vendor_perl<br>> /usr/lib/perl5/5.8.0/i386-linux-thread-multi
<br>> /usr/lib/perl5/5.8.0<br>><br>> Am I missing something that I can use to get a single:<br>><br>> use lib "/usr/local/FOO/lib/perl5";<br>><br>> statement to work (i.e., to include the site_perl tree, too)?
<br>><br>> Thanks,<br>> David<br>><br>> [1] There's no hope of getting them to set PERL5LIB in their environment<br>><br>> On 1/25/07, Quinn Weaver <<a href="mailto:quinn@fairpath.com">quinn@fairpath.com
</a>> wrote:<br>> > Right. And in this case, you'd do<br>> ><br>> > export PERL5LIB=/usr/local/FOO/lib/perl5 # bash syntax<br>> ><br>> > ... then Perl automatically searches under there for site_perl,
<br>> > site_perl/5.8.0, and all those other weirdly named subdirs that<br>> > Perl uses to install things.<br><br>--<br>Live in a world of your own, but always welcome visitors.<br>_______________________________________________
<br>SanFrancisco-pm mailing list<br><a href="mailto:SanFrancisco-pm@pm.org">SanFrancisco-pm@pm.org</a><br><a href="http://mail.pm.org/mailman/listinfo/sanfrancisco-pm">http://mail.pm.org/mailman/listinfo/sanfrancisco-pm</a>
<br></blockquote></div><br>