Yesterday I was feeling ill and bored and decided that it would be fun to watch CPAN get mirrored to my harddrive. I have been wanting to do some statistical analysis on the full CPAN set and I have plenty of room so I figured it would be a suitable distraction for my foggy head. I did a little googling and of course found merlyns useful article on making a Minimal CPAN mirror of the most recent files in the collection.
So of course I read the article, grabbed the code, plugged in my local paths and let it rip. The steady stream of messages about files being downloaded combined with my flu slowly lulled me into a pleasant stupor. Soon I fell sleepy and went for a nap.
Hours later I returned, somewhat refreshed and happy to discover that I was on 'X' and that soon it would be done. Preparations made, the decks cleared for war1, rations for the troops was provided2 and I settled into place to review the downloads, and....
My jaw fell suddenly, while I had been dallying an evil magician had been busy deleting the files, my return was to a log file showing all the precious gems that had been in my hands for the briefest of moments only to be spirited away! Crestfallen I retired from battlefield to analyze what went wrong.....
The responsible code was in two short lines:
and=69= my $local_file = catfile($LOCAL, split "/", $path);
=105= return unless -f and not $mirrored{$File::Find::name};
for you see, File::Spec::Functions::catfile returns a localized path, and $File::Find::name contains a non localized (in fact not even canonical) string. The solution, albeit probably not the cleanest was to use the following as a replacement for line 105.
my ($v,$p,$n)=splitpath($File::Find::name); my $name=catfile($v,splitdir($p),$n); return unless -f and not $mirrored{$name};
It seems everyone get bitten by this kind of thing at some point or another...
In reply to OS issues get everybody at some point by demerphq
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |