diff options
author | David Golden <dagolden@cpan.org> | 2010-07-18 16:02:49 -0400 |
---|---|---|
committer | David Golden <dagolden@cpan.org> | 2010-07-18 16:02:49 -0400 |
commit | a08d2aaddd0e34ad9ca2b286dd71de3a8d53e3df (patch) | |
tree | bf1af99ae105ec2f39377774f18877c800714724 /Porting/core-cpan-diff | |
parent | e66db76dc0d5c287207937130fcf4ceed0804242 (diff) | |
download | perl-a08d2aaddd0e34ad9ca2b286dd71de3a8d53e3df.tar.gz |
core-cpan-diff: fix handling of file:/// urls
Diffstat (limited to 'Porting/core-cpan-diff')
-rwxr-xr-x | Porting/core-cpan-diff | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Porting/core-cpan-diff b/Porting/core-cpan-diff index b6a150d9e1..0f303c2c70 100755 --- a/Porting/core-cpan-diff +++ b/Porting/core-cpan-diff @@ -10,6 +10,8 @@ use warnings; use 5.010; use Getopt::Long; +use File::Basename (); +use File::Copy (); use File::Temp (); use File::Path (); use File::Spec; @@ -539,6 +541,7 @@ my $lwp_simple_available; sub my_getstore { my ($url, $file) = @_; + File::Path::mkpath(File::Basename::dirname($file)); unless (defined $lwp_simple_available) { eval { require LWP::Simple }; $lwp_simple_available = $@ eq ''; @@ -546,6 +549,10 @@ sub my_getstore { if ($lwp_simple_available) { return LWP::Simple::is_success(LWP::Simple::getstore($url, $file)); } + elsif ( $url =~ qr{\Afile://(?:localhost)?/} ) { + (my $local_path = $url) =~ s{\Afile://(?:localhost)?}{}; + File::Copy::copy( $local_path, $file ); + } else { return system(WGET_CMD, "-O", $file, $url) == 0; } |