How can I find and remove duplicate Perl modules from the library?

advertisements

I've been using Module::Build to manage my module installation and I've found that I have duplicate versions of a given module in different parts of the library:

./site_perl/5.14.2/i686-linux/site_perl/Support/Dump.pm
./site_perl/5.14.2/Support/Dump.pm

This is a concern to me, because I can't be sure that they will stay in sync.

Is there a way to find and remove duplicate files of this sort? Or are these here because of something that I did and can I control that?


That's probably because you added/removed XS code from your module. If you added XS code, the first one is the current one (good), if you removed all XS code, the second one is the current one (not good). This is unlikely to be a long-term problem, so a long-term solution may be unnecessary.

If you run perl -V, you'll notice the order of every path in your @INC. Perl will likely have your i686-linux/site_perl directory before the normal one, so your XS version will get loaded, and the other one will be ignored. It doesn't matter if they're in sync or not, only one will get loaded. Thus, the important thing is that if you remove all the XS code so it becomes a pure-perl module, you'll have to delete the XS version from your tree. This is rare - once you start doing XS, usually it's not removed. Even dual-life modules (List::MoreUtils) keep their XS code and merely have a way to determine if it got installed or not, and have a way to disable the XS code for testing purposes. But they don't actually get rid of the XS code.

Most likely, you added XS code so it was no longer pure-perl, and everything will be fine.