Subject: | trimming cache directory on Win32 |
With the current (1.88_63) CPAN.pm, I find on Win32 that the cache
directory doesn't get trimmed when it gets too full because the comparison:
File::Basename::dirname($dir) eq $CPAN::Config->{build_dir}
fails on Win32, due to a difference only in the directory separator (eg,
this concludes C:\Perl\cpan and C:\Perl/cpan aren't equal). I've
attached a diff against the latest CPAN.pm from svn which resolves this.
Subject: | cpan_cache.diff |
Index: CPAN.pm
===================================================================
--- CPAN.pm (revision 1335)
+++ CPAN.pm (working copy)
@@ -1360,7 +1360,8 @@
sub force_clean_cache {
my($self,$dir) = @_;
return unless -e $dir;
- unless (File::Basename::dirname($dir) eq $CPAN::Config->{build_dir}) {
+ unless (File::Spec->canonpath(File::Basename::dirname($dir))
+ eq File::Spec->canonpath($CPAN::Config->{build_dir})) {
$CPAN::Frontend->mywarn("Directory '$dir' not below $CPAN::Config->{build_dir}, ".
"will not remove\n");
$CPAN::Frontend->mysleep(5);
@@ -5535,7 +5536,8 @@
sub store_persistent_state {
my($self) = @_;
my $dir = $self->{build_dir};
- unless (File::Basename::dirname($dir) eq $CPAN::Config->{build_dir}) {
+ unless (File::Spec->canonpath(File::Basename::dirname($dir))
+ eq File::Spec->canonpath($CPAN::Config->{build_dir})) {
$CPAN::Frontend->mywarn("Directory '$dir' not below $CPAN::Config->{build_dir}, ".
"will not store persistent state\n");
return;