Disclaimer: This blog post summarizes much of the publicly available information we know about Perl 7 to date. As with anything under development, features and dates may change.
On June 24, 2020 Perl 7 was announced at The Perl Conference as “Perl 5.32 with modern defaults.” In other words, all the modern conveniences you now manually enable will be enabled by default.
This is convenient, but not revolutionary, so why announce this as the next major version of Perl?
More than laying the groundwork for the future, Perl 7 is meant to make a break with the past by easing Perl out of its longstanding commitment to backward compatibility. This means that the legacy defaults from Perl 4 and 5 that no longer make sense in our more modern computing environment are likely to be removed.
As with every release of Perl, Perl 7 will be tested against modules from the Comprehensive Perl Archive Network (CPAN) to ensure compatibility. Maintainers will be notified if their modules are breaking, and given a chance to fix them. But since Perl 7 is “mostly Perl 5.32” things that have been regularly updated should just work.
In summary: Perl 7 will be Perl 5.32 with maximum modern practices and minimal historical baggage. The first release candidate should be available by the end of 2020, with a user release happening sometime in the first half of 2021. As stated in our Future of Perl ActiveState blog, ActiveState is committed to creating an ActivePerl 7 Community Edition (CE) distribution, incorporating the base language and many of the most popular community packages.
The Future of ActivePerl 5
It has been suggested that Perl 5 could be maintained for as long as 10 years from the release date of the two last versions (v5.30 and v5.32). ActiveState has always followed the lead of the community and will continue to provide support for our upcoming ActivePerl 5.32 for as long as the Perl core developers remain committed to Perl 5.
ActiveState is well known for providing commercial support for older versions of ActivePerl. Even when a particular release of Perl has reached EOL, we continue to offer commercial support for some years via the corresponding ActivePerl version. As the community migrates to Perl 7, ActiveState will evaluate our support for older versions of ActivePerl, and sunset them, as appropriate.
Preparing to Migrate to Perl 7
The best way to prepare is to read the book: Preparing for Perl 7. It provides excellent guidance for those that need to understand the details of how to start preparing to make the transition.
(We are giving away 7 copies of Brian’s book on LinkedIn, Facebook, and Twitter! Enter before September 14th, 2020 for a chance to win.)
In a more general sense, despite the fact that Perl 7 is not yet nailed down, there are a few things you can do right now to check that your existing code is in good shape for the move, including:
- Make sure you can run your code with the following settings:
- enable strict by default
% perl -Mstrict program.pl
- enable warnings by default
% perl -Mwarnings program.pl
- disable bareword filehandles
% perl -M-bareword::filehandles
- disable multidimensional array emulation (a Perl 4 trick)
% perl -M-multidimensional program.pl
- enable subroutine signatures
% perl -Mfeature=signatures program.pl
- change prototypes to use the :prototype attribute
- enable strict by default
As noted earlier, these features are still in flux. You can find the latest proposals on the Perl GitHub Wiki
These are simple enough guidelines, but they can have a huge negative impact on older and/or messier code. Luckily, you can at least initially rely on compatibility modes to continue running your older code while you migrate to Perl 7.
And when it comes to migration, ensure you follow best practices:
- Never migrate production code – always work on a branch.
- Upgrade to the latest version (Perl 5.32) and work out any kinks there before tackling Perl 7.
- Update your test suite. Testing will be crucial to identifying issues and ensuring a smooth migration. To make things easier, consider automating your tests by setting it up on a CI/CD service like GitHub Actions, Azure Pipelines, Travis CI, or similar.
- Run Perl Critic. Depending on how old your code is, Perl Critic may overwhelm you with errors. Approach them one module or script at a time in order to limit the scope.
Keep in mind that the only way to eat an elephant is one bite at a time. When you get one file working, move on to the next, testing along the way.
Adopting Perl 7
While Perl 7 can seem like a scary prospect for those used to the backward compatibility legacy of Perl 5, it’s just a baby step along the way to the modernization of Perl.
Major versions are labeled major for a reason since they often introduce breaking changes. We’re lucky with Perl 7 in that its breaking changes are largely for the best, doing away with outdated conventions that should have been deprecated long ago. Perl 8 will likely be far more radical than Perl 7. To keep up, it’s important to start adopting the structures and policies of Perl 7 as soon as possible, since they will largely define how the Perl language will evolve.
While you’re waiting for Perl 7, you might want to get familiar with the ActiveState Platform and our State Tool CLI, since they will be at the heart of all our Perl solutions going forward:
- Check out the ActiveState Platform catalog of buildable modules by forking a version of our ActivePerl 5.28 (requires a free account). Just click the Add Packages button to search for your favorite modules.
- Install the State Tool and test out its ability to install a Perl runtime into an isolated virtual environment so you can work on multiple projects without conflicts. The easiest way to do so is just to download and install ActivePerl 5.26 or ActivePerl 5.28 since it comes with the State Tool.
- To install the State Tool on Windows:
- To install the State Tool on Linux:
sh <(curl -q https://platform.activestate.com/dl/cli/install.sh)
- Run the following command to download the runtime and automatically install it into a virtual environment:
state activate Pizza-Team/Perl-5.28
- Learn more about how to use the State Tool.