Perl-Advent icon indicating copy to clipboard operation
Perl-Advent copied to clipboard

Bumping your code's Perl version

Open book opened this issue 1 year ago β€’ 3 comments

Which Perl module do you want to write about: Perl::Version::Bumper (to be released)

Please give a short description of the article you want to write. Two to three sentences is fine:

The article would describe what use VERSION actually does, how Perl handles backward and forward compatibility, and how to use the above module to safely "bump" any Perl code to the desired version.

book avatar Aug 07 '24 09:08 book

Not that it has to be part of the article, but I use PPI::App::ppi_version::BDFOY. Curious to see what you've come up with.

briandfoy avatar Aug 07 '24 11:08 briandfoy

Curious to see what you've come up with.

The repository is here: https://github.com/book/Perl-Version-Bumper/.

I'd recommend looking at the test data to see the kind of transformation it does.

book avatar Aug 07 '24 13:08 book

Also, before embarking on this journey, I did look for prior art. It seems I wasn't looking hard enough, or using the wrong keywords.

book avatar Aug 07 '24 14:08 book

And I just realized that my description is very confusing. :sweat_smile:

This module is not about changing: our $VERSION = 1.23; into our $VERSION = 1.24; in random Perl files. It's about bumping the declared Perl language version of some source code to a more recent version.

For example, when asked to "bump" the following code snippet:

use v5.20;
use warnings;
use experimental 'signatures';
use feature 'lexical_subs';
no warnings 'experimental::lexical_subs';
no indirect;

For v5.26, it would produce:

use v5.26;
use warnings;
use experimental 'signatures';
no indirect;

because it knows that:

  • the lexical_subs feature is enabled in the :5.26 feature bundle (and it knows about experimental warnings)

For v5.32, it would produce:

use v5.32;
use warnings;
use experimental 'signatures';
no feature 'indirect';

because it knows that:

  • the indirect module is a compatibility module for the indirect feature,
  • the indirect feature was introduced in v5.32

And for v5.36, it would produce:

use v5.36;

Because it knows that:

  • warnings are enabled by the :5.36 feature bundle
  • the signatures feature is enabled in the :5.36 feature bundle (and it knows about experimental)
  • the indirect feature is disabled in the :5.36 feature bundle

book avatar Nov 12 '24 21:11 book

That sounds pretty cool, along with Perl::MinimumVersion. I'd like to read this article.

briandfoy avatar Nov 13 '24 06:11 briandfoy

As the author of Syntax::Construct, I'm interested, too.

choroba avatar Nov 13 '24 07:11 choroba

Hello! This is your mid-November reminder that Advent is fast approaching. The first articles will go live in less than 3 weeks. We are very much looking forward to preparing your article for publication. If you could update this ticket with an ETA for your first draft that would be very helpful when it comes to planning ahead for editing, proofreading etc. πŸŒ²πŸ€ΆπŸŽ…πŸ§

oalders avatar Nov 13 '24 22:11 oalders

Hello! 😁 This is your late November reminder that we are going live in just a few days. Could you update this ticket with a target date for your first draft? πŸ“†

oalders avatar Nov 27 '24 21:11 oalders

Article was already merged. \o/

oalders avatar Dec 26 '24 18:12 oalders