Skip to content

Commit

Permalink
refactor CUSTOM_LIB, deprecated ~/.perl6/lib
Browse files Browse the repository at this point in the history
now %CUSTOM_LIB is a hash with (perl, site, vendor, home)
installation dirs, and the one in the home directory depends
on the exact Rakudo version.

For backward compatibility, ~/.perl6/lib is still in @*INC
  • Loading branch information
moritz committed Oct 18, 2012
1 parent 179b6c0 commit 27a6b84
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
10 changes: 10 additions & 0 deletions docs/deprecations
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@ Deprecations in 2012.10
This will change to make them equivalent to a one-level map.
Planned for the 2012.11 release.

~/.perl6/lib will go away from the default include path (@*INC).
Instead %*CUSTOM_LIB now holds paths to four library locations:
perl Rakudo installs its core modules here
vendor OS-level package managers should install their modules here
site for local module installations (e.g. with panda or ufo)
home like site, but always under the user's home directory.
fallback if site isn't writable.
Removal of ~/.perl6/lib from @*INC planned for the 2012.11 release


Deprecations in 2012.09

Str.capitalize and &capitalize are deprecated in favor
Expand Down
20 changes: 15 additions & 5 deletions src/core/terms.pm
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,23 @@ sub term:<time>() { nqp::p6box_i(nqp::time_i()) }
my @INC;
@INC.push(%ENV<RAKUDOLIB>.split($VM<config><osname> eq 'MSWin32' ?? ';' !! ':')) if %ENV<RAKUDOLIB>;
@INC.push(%ENV<PERL6LIB>.split($VM<config><osname> eq 'MSWin32' ?? ';' !! ':')) if %ENV<PERL6LIB>;
my $prefix := $VM<config><libdir> ~ $VM<config><versiondir> ~ '/languages/perl6';
my %CUSTOM_LIB;

%CUSTOM_LIB<perl> = $prefix;
%CUSTOM_LIB<vendor> = $prefix ~ '/vendor';
%CUSTOM_LIB<site> = $prefix ~ '/site';
@INC.push(%CUSTOM_LIB<perl> ~ '/lib');
@INC.push(%CUSTOM_LIB<vendor> ~ '/lib');
@INC.push(%CUSTOM_LIB<site> ~ '/lib');
try {
@INC.push((%ENV<HOME> // %ENV<HOMEDRIVE> ~ %ENV<HOMEPATH>) ~ '/.perl6/lib');
my $home := %ENV<HOME> // %ENV<HOMEDRIVE> ~ %ENV<HOMEPATH>;
my $ver := nqp::p6box_s(nqp::atkey($compiler, 'version'));
%CUSTOM_LIB<home> = "$home/.perl6/$ver";
@INC.push(%CUSTOM_LIB<home> ~ '/lib');
@INC.push($home ~ '/.perl6/lib');
}
@INC.push($VM<config><libdir> ~ $VM<config><versiondir> ~ '/languages/perl6/lib');
my $CUSTOM-LIB = $VM<config><libdir> ~ $VM<config><versiondir> ~ '/languages/perl6/custom';
@INC.push($CUSTOM-LIB ~ '/lib');
nqp::bindkey(pir::get_who__PP(PROCESS), '$CUSTOM-LIB', $CUSTOM-LIB);
nqp::bindkey(pir::get_who__PP(PROCESS), '%CUSTOM_LIB', %CUSTOM_LIB);

my $I := nqp::atkey(nqp::atkey(%*COMPILING, '%?OPTIONS'), 'I');
if nqp::defined($I) {
Expand Down

0 comments on commit 27a6b84

Please sign in to comment.