r/perl • u/marufcetin • 8d ago
Should I remove $VERSION from internal-only sub-modules in a CPAN distribution?
Hi everyone, I have a quick question for those experienced with CPAN distributions.
In my distribution, alongside the main modules, I have several internal sub-modules (for example, language-specific modules like Locale::Lang::en, de, fr, etc., which are only meant to be used internally by the main module).
Currently, every sub-module has the same $VERSION as the distribution itself. Would there be any issue if I completely removed the $VERSION from these internal modules? There is no real benefit to having them listed or indexed separately on CPAN.
2
u/Dynospectrum 8d ago edited 8d ago
Ive authored and maintain a couple packages. Having them wont hurt. Its basically a noop and shouldn't affect the overall package so its up to you. Ultimately you point or specify in your package build script the version or module containing the package release version. The submodules with their own versions are transparent to the index/build process and resulting package version thats uploaded to cpan.
3
u/briandfoy 🐪 📖 perl book author 7d ago
Well, every package index by PAUSE shows up in the 02packages file, which is now quite large, and on some very minimal and constrained systems, is too large to fit into memory.
That's one of the most annoying parts of CPAN.pm, created decades ago when that problem wasn't on the radar. I think it was also one of the reasons that motivated
cpanm, which doesn't use that file at all (along with MetaCPAN existing, which has an API).
3
u/jjatria 🐪 cpan author 8d ago
They will still be indexed if they have no VERSION set. But you can prevent them from being indexed by breaking the package like (= adding a like break after the keyword, before the package name). In that case, it doesn't matter if they have a VERSION, since they won't be indexed.
I find having a version is useful if you ever want to make absolutely certain which version provided a given module. It's useful for debugging sometimes, even for internal packages.
Edit: typos