Injecting a new version of a module doesn't remove oldest entry #2

sukria opened this Issue Nov 8, 2010 · 2 comments

3 participants


Hi, first of all, thanks for CPAN::Mini::Inject, it's a great tool.

I have an issue though I'd like to fix. When I inject a new version of module that has already been injected (like injecting Foo 0.02 in a mirror where Foo 0.01 exist) the old line is not removed from 02packages.default.txt.gz

This makes cpanminus fail at downloading the correct version (it takes the first line it finds in the txt.gz file, which is the oldest one).

Would it be possible to make CPAN::Mini::Inject produce a file with only the last version injected?



I've found this to be a problem, too.
It certainly seems unnecessary to have to run a minicpan update in between add and inject just to remove the older versions.
Has anyone thought about possible solutions?

The first idea I had was to copy the packages file before overwriting, then md5 the injected version...
upon next inject if the packages md5 is the same as the last time CMI overwrote, it could use the cached [original] packages file as the starting point. If the md5's are different, it's probably safe to assume a minicpan has run
and it's just time to inject normally.

Another idea I come up with was to keep a running list of entries that have been injected into the packages file and then filter those out when re-injecting...
similar to the way it removes the old version from the modulelist file,
but it would have to keep history i guess.

Have there been any other ideas?
If somebody had a good one I'd be happy to attempt to implement it.


An older fix for this by frodwith has been merged to my fork and released to CPAN as CMI 0.30.

@wchristian wchristian closed this Jun 15, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment