Perl error, once and for all

Vincent Lefevre vincent-opdarw at vinc17.org
Tue Mar 3 07:55:28 PST 2009


On 2009-03-03 07:30:18 -0800, Bradley Giesbrecht wrote:
> On Mar 1, 2009, at 5:11 PM, Vincent Lefevre wrote:
>>> if [ -n "$PERL5LIB" ]; then
>>>  PERL5LIB="${PERL5LIB}:/opt/local/lib/perl5/vendor_perl"
>>> else
>>>  export PERL5LIB
>>>  PERL5LIB="/opt/local/lib/perl5/vendor_perl"
>>> fi
>
> My path to p5's looks like this:
> 	/opt/local/lib/perl5/vendor_perl/5.8.9/
>
> Wouldn't the full path including the version dir need to be added to  
> PERL5LIB?

I don't know whether this has changed in Perl 5.8.9 (I haven't
upgraded yet), but with previous versions, the version dir should
not be used in $PERL5LIB, as perl automatically adds the paths so
that modules installed with previous versions can still be used.
For instance:

$ perl -V
[...]
  %ENV:
    PERL5LIB="/Users/vinc17/lib/site_perl:/opt/local/lib/perl5/vendor_perl"
  @INC:
    /Users/vinc17/lib/site_perl/darwin-2level
    /Users/vinc17/lib/site_perl
    /opt/local/lib/perl5/vendor_perl/5.8.8/darwin-2level
    /opt/local/lib/perl5/vendor_perl/5.8.8
    /opt/local/lib/perl5/vendor_perl/5.8.7/darwin-2level
    /opt/local/lib/perl5/vendor_perl/5.8.7
    /opt/local/lib/perl5/vendor_perl
    /opt/local/lib/perl5/5.8.8/darwin-2level
    /opt/local/lib/perl5/5.8.8
    /opt/local/lib/perl5/site_perl/5.8.8/darwin-2level
    /opt/local/lib/perl5/site_perl/5.8.8
    /opt/local/lib/perl5/site_perl/5.8.7/darwin-2level
    /opt/local/lib/perl5/site_perl/5.8.7
    /opt/local/lib/perl5/site_perl
    /opt/local/lib/perl5/vendor_perl/5.8.8/darwin-2level
    /opt/local/lib/perl5/vendor_perl/5.8.8
    /opt/local/lib/perl5/vendor_perl/5.8.7/darwin-2level
    /opt/local/lib/perl5/vendor_perl/5.8.7
    /opt/local/lib/perl5/vendor_perl
    .

> Are you suggesting using this in Portfiles?

Either the Portfile could provide the necessary options (I don't know
which ones) to change the default @INC in the perl binary (with the
advantage that modifying the environment variable won't be necessary)
or the PERL5LIB variable needs to be changed in the .profile (either
by MacPorts (base?) or by the user).

> If I have perl5.8 active and install a p5 and then deactivate perl5.8  
> and activate perl5.10 should I expect my p5 to be active and functional?

I haven't tried. See the "perl -V" output without the version number
in $PERL5LIB.

-- 
Vincent Lefèvre <vincent at vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)


More information about the macports-users mailing list