PDL
view release on metacpan or search on metacpan
lib/PDL/AutoLoader.pm view on Meta::CPAN
local $_;
foreach $_(@PDLLIB) {
# Expand ~{name} and ~ conventions.
if(s/^(\+?)\~(\+||[a-zA-Z0-9]*)//) {
if($2 eq '+') {
# Expand shell '+' to CWD.
$_= $1 . ($ENV{'PWD'} || '.');
} elsif(!$2) {
# No name mentioned -- use current user.
# Ideally would use File::HomeDir->my_home() here
$_ = $1 . ( $ENV{'HOME'} || (( getpwnam( getlogin || getpwuid($<) ))[7]) ) . $_;
} else {
# Name mentioned - try to get that user's home directory.
$_ = $1 . ( (getpwnam($2))[7] ) . $_;
}
}
# If there's a leading '+', include all subdirs too.
push(@PDLLIB_EXPANDED,
s/^\+// ? PDL::AutoLoader::expand_dir($_) : $_
);
t/autoload.t view on Meta::CPAN
is_pdl autoload_func($x), pdl('29 29; 29 29'), 'autoloaded func worked';
{ no warnings 'once';
is $::GLOBAL_VAR, '$'.'COMP(max_it)', "NiceSlice didn't mangle text";
}
#check that tilde expansion works (not applicable on MS Windows)
SKIP: {
skip "Inapplicable to MS Windows", 1 if $^O =~ /MSWin/i;
my $tilde = (PDL::AutoLoader::expand_path('~'))[0];
my $get = $ENV{'HOME'} || (getpwnam( getlogin || getpwuid($<) ))[7];
my $glob = glob q(~);
if ($glob !~ /^~/) {
is($tilde, $glob, "Check tilde expansion (Got '$get' from (getpwnam(getpwuid(\$<)))[7] )");
} else {
is($tilde, $get, "Check tilde expansion (Got '$glob' from glob ~");
}
}
done_testing;
( run in 0.356 second using v1.01-cache-2.11-cpan-8d75d55dd25 )