Re: $VERSION in module files
by haukex (Archbishop) on Mar 26, 2020 at 10:24 UTC
|
See my reply in the thread What basic things should I know about versioning modules? that a 1.23 style versioning should provide maximum compatibility, specified in a format of our $VERSION = "1.23";. Of course, TIMTOWTDI, and you'll see some modules use interesting versioning schemes and some modules use code to determine $VERSION like parsing it out of a VCS $Revision$ string. See the documentation in ExtUtils::MakeMaker's VERSION_FROM and ExtUtils::MM_Unix's parse_version, but note that those are probably not the only tools that parse version strings out of module files, so I'd really only recommend our $VERSION = string;.
| [reply] [d/l] [select] |
|
| [reply] |
|
| [reply] |
|
|
|
package Foo;
our $VERSION = '1.01';
# ...
package Foo::Bar;
use Foo;
our $VERSION = $Foo::VERSION;
I never bother specifying version numbers in POD so you're on your own there. :-) Doubtless there's a way in Dist::Zilla but then you'd have $problems++
| [reply] [d/l] [select] |
|
|
|
|
|
|
|
|
In Win32::Mechanize::NotepadPlusPlus, I added a rule in my Makefile.PL postamble, so that make populateversion will take the VERSION that the Makefile sees (which it grabs from the "primary" module in the dist, thanks to $mm_args{VERSION_FROM} ), and uses perl to do an in-place edit of the our $VERSION =... from the related modules.
# auto-populate the VERSION in the submodules from $(VERSION), which c
+omes from main module
populateversion :: lib/Win32/Mechanize/NotepadPlusPlus.pm
$(NOECHO) $(ECHO) want to auto-populate VERSION in all sub-modules
+: $(VERSION)
$(PERL) -pi -e "s/^(\s*our\s+.VERSION\s*=).*?;.*?$$/\1 '$(VERSION)
+'; # auto-populated from W::M::NPP/" lib/Win32/Mechanize/NotepadPlusP
+lus/Notepad.pm lib/Win32/Mechanize/NotepadPlusPlus/Editor.pm
So I just have to change the version in one master location, and then make populateversion (or, since I have other rules that depend on that rule, run one of those other rules for doing other documentation updates) to get the version in sync across the modules. | [reply] [d/l] [select] |
Re: $VERSION in module files
by choroba (Cardinal) on Mar 28, 2020 at 12:42 UTC
|
Not sure about the best practice, but if you're interested in what I did:
xt/version.t
and
xt/changes.t
for Syntax::Construct, plus extract_version in its Makefile.PL.
map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
| [reply] [d/l] |
Re: $VERSION in module files
by BillKSmith (Monsignor) on Mar 27, 2020 at 03:35 UTC
|
I know that it is off-topic, but I recommend that you read the section "Version Numbers" in the book "Perl Best Practices". When you are working with versions numbers, it helps to know the options.
| [reply] |
|
I know that it is off-topic, but I recommend that you read the section "Version Numbers" in the book "Perl Best Practices". When you are working with versions numbers, it helps to know the options. Bill *yawn* Module version numbers best practice
| [reply] |
Re: $VERSION in module files
by syphilis (Archbishop) on Mar 27, 2020 at 12:29 UTC
|
Ummm ... what's with the "pod Version strings" ?
I've never assigned versions to pod.
I've only ever assigned version numbers in the .pm files.
Have I missed something ? (I'm not assuming that the correct answer is not "yes".)
Cheers, Rob
| [reply] |
|
> module-starter --module=Foo::Bar,Foo::Bat --author="XYZ" --email=abc
+@xyz.com
> cat Foo-Bar/lib/Foo/Bar.pm
...
=head1 NAME
Foo::Bar - The great new Foo::Bar!
=head1 VERSION
Version 0.01
=cut
our $VERSION = '0.01';
| [reply] [d/l] [select] |
|
I thought I was cargo culting but just confirmed that module-starter does it (and use it to start a module)
Yeah, fair enough ... but that sort of begs 2 additional questions:
1) What happens if you don't put a =head1 VERSION section in your pod;
2) Why has the absence of such a pod heading in any of my modules not caused me any problems - not to mention unbearable embarrassment and humiliation ?
Sorry ... I'm being a bit of a halfsmartarse in posing it that way.
Nothing against you, bliako, I'm really just wondering if there's some point in going to such lengths.
Cheers, Rob
| [reply] [d/l] |