I'm maintaining a CPAN distribution that has over 100 .pm files. Do each of them need to have a $VERSION, or is it okay to just include it in the main module?
For the other modules in the distribution, what effect does including or not including the $VERSION have?
In case it's relevant to the question, people should only be "use"-ing the main module in this distribution. And, for the purpose of this question, I'm not asking about how it should be specified in any file, just whether or not it's present in any form.
Empirically, lots of modules don't put the version number in every .pm
file. If you do a snapshot bundle (b
in cpanp
) and look at the generated file, you'll see that. On my machine, the snapshot for Perl 5.16.2 with lots of modules added contained 7962 modules, but 2070 of those included 'undef' as the version (so roughly 1 in 4 has undef as the version).
Personally, I don't like that, so all the .pm
files in my module — DBD::Informix — are version stamped with the same version in each release (the current release is 2013.0118, and all the .pm
files are stamped with 2013.0118 as the version number), but there are lots of modules (people) that do it otherwise.
.pm
file..pm
file..pm
files in a distribution.In my view, the worst problems come when a module is updated but some bit isn't, so CPANPLUS thinks the module is out of date even though installing the latest version doesn't change anything. I've got 5 modules like that at the moment, and I'm sorely tempted to delete them all, especially since I'm not really using them. (Sometimes, that's triggered by a file being installed in a new location, but I don't think that's the only cause. I'm not sure what else triggers it, but it is a problem that occurs periodically.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With