Subject: | "CPAN::Shell->install('.')" vs "cpan ." |
Hi there,
It looks like that
[perl]
use CPAN;
chdir '/path/to/decompressed/module';
CPAN::Shell->install('.');
doesn't behave the same as
[bash]
$ cd /path/to/decompressed/module
$ cpan .
Indeed:
[perl]
$ pwd
/data/home/poleggim/tmp
$ ./cpan_dot_test.pl
cwd=/tmp/O3g4WBN_IG/Catalyst-Model-DBIDM-0.04
PWD=/tmp/O3g4WBN_IG/Catalyst-Model-DBIDM-0.04
CPAN::iCwd=/data/home/poleggim/tmp
You are visiting the local directory
'.'
without lock, take care that concurrent processes do not do likewise.
...
DONE
Restored the state of none (in 0.9252 secs)
You are visiting the local directory
'/data/home/poleggim/tmp/.'
As yuo can see ^^above^^, the cwd is the same as the starting directory.
So basically, cpan::shells ignores $ENV{PWD} even though it uses the Cwd
module as the test script. Incidentally, I found that cpan::shell uses
an internal pwd -- $CPAN::iCwd, which, if properly set, makes it do the
Right Thing (line #14 of cpan_dot_test.pl uncommented):
$ ./cpan_dot_test.pl
cwd=/tmp/O3g4WBN_IG/Catalyst-Model-DBIDM-0.04
PWD=/tmp/O3g4WBN_IG/Catalyst-Model-DBIDM-0.04
CPAN::iCwd=/tmp/O3g4WBN_IG/Catalyst-Model-DBIDM-0.04
You are visiting the local directory
'.'
without lock, take care that concurrent processes do not do
likewise.
...
DONE
Restored the state of none (in 0.9148 secs)
You are visiting the local directory
'/tmp/O3g4WBN_IG/Catalyst-Model-DBIDM-0.04/.'
without lock, take care that concurrent processes do not do likewise.
Running make for /tmp/O3g4WBN_IG/Catalyst-Model-DBIDM-0.04/.
...
Am I missing something?
Cheers,
Marco
Subject: | cpan_dot_test.pl |
#!/usr/local/bin/perl -w
use strict;
use warnings;
use Cwd qw(getcwd chdir);
use CPAN;
my $mod_path = '/tmp/O3g4WBN_IG/Catalyst-Model-DBIDM-0.04';
chdir $mod_path or die $!;;
my $cwd = getcwd;
print "cwd=$cwd\n";
print "PWD=$ENV{PWD}\n";
# $CPAN::iCwd = $cwd;
print "CPAN::iCwd=$CPAN::iCwd\n";
CPAN::Shell->install('.');