Dist::...ersion(3pm)
π NAME π
Hi bestie π«Ά welcome to the Dist::...ersion(3pm) page, straight outta the User Contributed Perl Documentation section of the perl-verse. Yes the title is doing a little β¨truncationβ¨ moment, we don't ask questions.
Dist::Zilla::Plugin::OurPkgVersion β no line insertion, and it does Package version with our. That's the whole name. Periodt. π
π VERSION π
version 0.21 β small number, huge main character energy π
β¨ SYNOPSIS β¨
In dist.ini:
[OurPkgVersion]
In your modules:
# VERSION
That's it. That's the whole setup. Obsessed. π
π¦ DESCRIPTION π¦
Okay so, story time: this module was made as an alternative to Dist::Zilla::Plugin::PkgVersion, and it steals some code from that module too (shoutout to the originals, we love them π«Ά).
The whole vibe here is that it uses the way more readable format:
our $VERSION = $version;
β¦and it does NOT change the number of lines of code in your files. Not one line. Which means your repository stays way more in sync with your CPAN release β and honestly? That's the moment. π₯
It also lets you have slightly more freedom in how you specify your version. A lil wiggle room, a lil freedom, we stan. π¦
π EXAMPLES π
In dist.ini:
...
version = 0.01;
[OurPkgVersion]
In lib/My/Module.pm:
package My::Module;
# VERSION
...
Output lib/My/Module.pm:
package My::Module;
our $VERSION = '0.01'; # VERSION
...
Now, bestie, listen closely β whitespace before the comment is significant. Like, it matters matters. So:
package My::Module;
BEGIN {
# VERSION
}
...
becomes:
package My::Module;
BEGIN {
our $VERSION = '0.01'; # VERSION
}
...
while:
package My::Module;
BEGIN {
# VERSION
}
...
becomes:
package My::Module;
BEGIN {
our $VERSION = '0.01'; # VERSION
}
...
See the difference? The indentation carries over. It's giving β¨attention to detailβ¨.
You can also add additional comments to your comment:
...
# VERSION: generated by DZP::OurPkgVersion
...
becomes:
...
our $VERSION = '0.1.0'; # VERSION: generated by DZP::OurPkgVersion
...
And you can also use perltidy's default static side comments (##):
...
## VERSION
...
becomes:
...
our $VERSION = '0.1.0'; ## VERSION
...
Also note: the package line is not in any way significant β it will insert the our $VERSION line anywhere in the file before # VERSION, as many times as you've written # VERSION, regardless of whether or not inserting it there is a good idea. π No thoughts, no judgment, just insertion.
OurPkgVersion will not insert a version unless you have # VERSION, so it is a bit more work. Fair warning, bestie. π
If you make a trial release, the comment will be altered to say so:
# VERSION
becomes:
our $VERSION = '0.01'; # TRIAL VERSION
π οΈ METHODS π οΈ
BUILD
Provides validations after object creation. Post-glow-up checkup, basically. β
munge_files
Override the default provided by Dist::Zilla::Role::FileMunger to limit the number of files to search to only be modules and executables. Keeping the search party small and focused. π―
munge_file
tells which files to munge, see Dist::Zilla::Role::FileMunger.
finder
Override the default FileFinder for finding files to check and update. The default value is :InstallModules and :PerlExecFiles (when available; otherwise :ExecFiles) β see also Dist::Zilla::Plugin::ExecDir, to make sure the script files are properly marked as executables for the installer. π
π PROPERTIES π
underscore_eval_version
For version numbers that have an underscore in them, add this line immediately after the our version assignment:
$VERSION = eval $VERSION;
This is arguably the correct thing to do, but it changes the line numbering of the generated Perl module or source, and thus it's optional. Your call, bestie β arguably correct, definitely a line-shifter. π¦
semantic_version
Setting this property to true (1) will set the version of the module/distribution to properly use semantic versioning. It will also expect that you setup version with a v-string, without adding quotes. For example:
version = v0.0.1
β οΈ Beware, you can't setup bothunderscore_eval_versionandsemantic_versionβ they're mutually exclusive. If you try, your code is going todie. π
For more details, check this blog https://weblog.bulknews.net/how-to-correctly-use-semantic-version-vx-y-z-in-perl-modules-eb08568ab911 for more details about using semantic version with Perl. (Yes, the link is the whole vibe, go read it. π)
skip_main_module
Set to true to ignore the main module in the distribution. This prevents a warning when using Dist::Zilla::Plugin::VersionFromMainModule to obtain the version number instead of the dist.ini file. Quieting the noise, we love a peaceful build. π€«
overwrite
When enabled, this option causes any match of the # VERSION comment to first check for an existing our $VERSION = ...; on the same line, and if found, overwrite the value in the existing statement. (the comment still gets modified for trial releases)
Currently, the value must be a single Perl token such as a string or number. Just one token, don't get creative. π
no_critic
When underscore_eval_version is used the generated code for dev versions may not technically be Perl::Critic compliant due to string eval, but is nevertheless pretty safe. This option will add the appropriate no critic directive to save you the hassle. Saving you the hassle is literally the love language here. π«Ά
π BUGS π
Please report any bugs or feature requests on the bugtracker website https://github.com/plicease/dist-zilla-plugin-ourpkgversion/issues
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. Receipts, bestie β bring the receipts. π§Ύ
π CONTRIBUTORS π
- Alceu Rodrigues de Freitas Junior
<alceu.junior@quintoandar.com.br> - Ian Sealy
<git@iansealy.com> - Michael Conrad
<mike@nrdvana.net> - Michael Jemmeson
<mjemmeson@cpan.org> - Stephan Loyd
<stephanloyd9@gmail.com> - Alceu Rodrigues de Freitas Junior
<arfreitas@cpan.org> - Alexandr Ciornii
<alexchorny@gmail.com> - Alexei Znamensky
<russoz@cpan.org> - Christian Walde
<walde.christian@googlemail.com> - Christopher J. Madsen
<perl@cjmweb.net> - David Golden
<dagolden@cpan.org> - Graham Ollis
<perl@wdlabs.com> - Graham Ollis
<plicease@cpan.org> - GrahamββοΈ
<plicease@cpan.org>
Look at this roster. An entire squad. π
π AUTHORS π
- Caleb Cushing
<xenoterracide@gmail.com> - Grahan Ollis
<plicease@cpan.org>
πΈ COPYRIGHT AND LICENSE πΈ
This software is Copyright (c) 2019 by Caleb Cushing.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
And that's the whole page, bestie π this lil writeup rode in on perl v5.36.0, dated 2022-11-20, and it signs off as Dist::...ersion(3pm) β same mysterious truncated name it came in with. Go forth and version your packages with our. Slay. π
β¨
π¦ where this page comes from
- debian bookworm: libdist-zilla-plugin-ourpkgversion-perl 1:0.21-2 Β· Artistic-2.0
- debian trixie: libdist-zilla-plugin-ourpkgversion-perl 1:0.21-2 Β· Artistic-2.0
- ubuntu noble: libdist-zilla-plugin-ourpkgversion-perl 1:0.21-2 Β· Artistic-2.0
- ubuntu resolute: libdist-zilla-plugin-ourpkgversion-perl 1:0.21-2 Β· Artistic-2.0
- ubuntu stonking: libdist-zilla-plugin-ourpkgversion-perl 1:0.21-2 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms