CPAN.pm (CPAN-2.27) | : | CPAN.pm (CPAN-2.28) | ||
---|---|---|---|---|
# -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- | # -*- Mode: cperl; coding: utf-8; cperl-indent-level: 4 -*- | |||
# vim: ts=4 sts=4 sw=4: | # vim: ts=4 sts=4 sw=4: | |||
use strict; | use strict; | |||
package CPAN; | package CPAN; | |||
$CPAN::VERSION = '2.27'; | $CPAN::VERSION = '2.28'; | |||
$CPAN::VERSION =~ s/_//; | $CPAN::VERSION =~ s/_//; | |||
# we need to run chdir all over and we would get at wrong libraries | # we need to run chdir all over and we would get at wrong libraries | |||
# there | # there | |||
use File::Spec (); | use File::Spec (); | |||
BEGIN { | BEGIN { | |||
if (File::Spec->can("rel2abs")) { | if (File::Spec->can("rel2abs")) { | |||
for my $inc (@INC) { | for my $inc (@INC) { | |||
$inc = File::Spec->rel2abs($inc) unless ref $inc; | $inc = File::Spec->rel2abs($inc) unless ref $inc; | |||
} | } | |||
skipping to change at line 561 | skipping to change at line 561 | |||
sub _yaml_loadfile { | sub _yaml_loadfile { | |||
my($self,$local_file) = @_; | my($self,$local_file) = @_; | |||
return +[] unless -s $local_file; | return +[] unless -s $local_file; | |||
my $yaml_module = _yaml_module; | my $yaml_module = _yaml_module; | |||
if ($CPAN::META->has_inst($yaml_module)) { | if ($CPAN::META->has_inst($yaml_module)) { | |||
# temporarily enable yaml code deserialisation | # temporarily enable yaml code deserialisation | |||
no strict 'refs'; | no strict 'refs'; | |||
# 5.6.2 could not do the local() with the reference | # 5.6.2 could not do the local() with the reference | |||
# so we do it manually instead | # so we do it manually instead | |||
my $old_loadcode = ${"$yaml_module\::LoadCode"}; | my $old_loadcode = ${"$yaml_module\::LoadCode"}; | |||
my $old_loadblessed = ${"$yaml_module\::LoadBlessed"}; | ||||
${ "$yaml_module\::LoadCode" } = $CPAN::Config->{yaml_load_code} || 0; | ${ "$yaml_module\::LoadCode" } = $CPAN::Config->{yaml_load_code} || 0; | |||
${ "$yaml_module\::LoadBlessed" } = 1; | ||||
my ($code, @yaml); | my ($code, @yaml); | |||
if ($code = UNIVERSAL::can($yaml_module, "LoadFile")) { | if ($code = UNIVERSAL::can($yaml_module, "LoadFile")) { | |||
eval { @yaml = $code->($local_file); }; | eval { @yaml = $code->($local_file); }; | |||
if ($@) { | if ($@) { | |||
# this shall not be done by the frontend | # this shall not be done by the frontend | |||
die CPAN::Exception::yaml_process_error->new($yaml_module,$local _file,"parse",$@); | die CPAN::Exception::yaml_process_error->new($yaml_module,$local _file,"parse",$@); | |||
} | } | |||
} elsif ($code = UNIVERSAL::can($yaml_module, "Load")) { | } elsif ($code = UNIVERSAL::can($yaml_module, "Load")) { | |||
local *FH; | local *FH; | |||
unless (open FH, $local_file) { | if (open FH, $local_file) { | |||
local $/; | ||||
my $ystream = <FH>; | ||||
eval { @yaml = $code->($ystream); }; | ||||
if ($@) { | ||||
# this shall not be done by the frontend | ||||
die CPAN::Exception::yaml_process_error->new($yaml_module,$l | ||||
ocal_file,"parse",$@); | ||||
} | ||||
} else { | ||||
$CPAN::Frontend->mywarn("Could not open '$local_file': $!"); | $CPAN::Frontend->mywarn("Could not open '$local_file': $!"); | |||
return +[]; | ||||
} | ||||
local $/; | ||||
my $ystream = <FH>; | ||||
eval { @yaml = $code->($ystream); }; | ||||
if ($@) { | ||||
# this shall not be done by the frontend | ||||
die CPAN::Exception::yaml_process_error->new($yaml_module,$local | ||||
_file,"parse",$@); | ||||
} | } | |||
} | } | |||
${"$yaml_module\::LoadCode"} = $old_loadcode; | ${"$yaml_module\::LoadCode"} = $old_loadcode; | |||
${"$yaml_module\::LoadBlessed"} = $old_loadblessed; | ||||
return \@yaml; | return \@yaml; | |||
} else { | } else { | |||
# this shall not be done by the frontend | # this shall not be done by the frontend | |||
die CPAN::Exception::yaml_not_installed->new($yaml_module, $local_file, "parse"); | die CPAN::Exception::yaml_not_installed->new($yaml_module, $local_file, "parse"); | |||
} | } | |||
return +[]; | return +[]; | |||
} | } | |||
# CPAN::_yaml_dumpfile | # CPAN::_yaml_dumpfile | |||
sub _yaml_dumpfile { | sub _yaml_dumpfile { | |||
End of changes. 6 change blocks. | ||||
11 lines changed or deleted | 14 lines changed or added |