summaryrefslogtreecommitdiff
path: root/lib/CPAN/Module.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/CPAN/Module.pm')
-rw-r--r--lib/CPAN/Module.pm47
1 files changed, 42 insertions, 5 deletions
diff --git a/lib/CPAN/Module.pm b/lib/CPAN/Module.pm
index 64b2e092ff..eae5a73aaa 100644
--- a/lib/CPAN/Module.pm
+++ b/lib/CPAN/Module.pm
@@ -511,13 +511,45 @@ sub uptodate {
my $cpan = $self->cpan_version;
local ($^W) = 0;
CPAN::Version->vgt($cpan,$inst) and return 0;
- CPAN->debug(join("",
- "returning uptodate. inst_file[",
- $self->inst_file,
- "cpan[$cpan] inst[$inst]")) if $CPAN::DEBUG;
+ my $inst_file = $self->inst_file;
+ # trying to support deprecated.pm by Nicholas 2009-02
+ my $in_priv_or_arch = "";
+ my $isa_perl = "";
+ if ($] >= 5.011) { # probably harmful when distros say INSTALLDIRS=perl?
+ if (0 == CPAN::Version->vcmp($cpan,$inst)) {
+ if ($in_priv_or_arch = $self->_in_priv_or_arch($inst_file)) {
+ if (my $distribution = $self->distribution) {
+ unless ($isa_perl = $distribution->isa_perl) {
+ return 0;
+ }
+ }
+ }
+ }
+ }
+ CPAN->debug
+ (join
+ ("",
+ "returning uptodate. ",
+ "inst_file[$inst_file]",
+ "cpan[$cpan]inst[$inst]",
+ "in_priv_or_arch[$in_priv_or_arch]",
+ "isa_perl[$isa_perl]",
+ )) if $CPAN::DEBUG;
return 1;
}
+# returns true if installed in privlib or archlib
+sub _in_priv_or_arch {
+ my($self,$inst_file) = @_;
+ for my $confdirname (qw(archlibexp privlibexp)) {
+ my $confdir = $Config::Config{$confdirname};
+ if ($confdir eq substr($inst_file,0,length($confdir))) {
+ return 1;
+ }
+ }
+ return 0;
+}
+
#-> sub CPAN::Module::install ;
sub install {
my($self) = @_;
@@ -620,10 +652,15 @@ sub available_version {
#-> sub CPAN::Module::parse_version ;
sub parse_version {
my($self,$parsefile) = @_;
- my $have = eval { MM->parse_version($parsefile); };
+ alarm(10);
+ my $have = eval {
+ local $SIG{ALRM} = sub { die "alarm\n" };
+ MM->parse_version($parsefile);
+ };
if ($@) {
$CPAN::Frontend->mywarn("Error while parsing version number in file '$parsefile'\n");
}
+ alarm(0);
my $leastsanity = eval { defined $have && length $have; };
$have = "undef" unless $leastsanity;
$have =~ s/^ //; # since the %vd hack these two lines here are needed