Perl v5.40.0 Shows That It Is Too Resilient To Die |
Written by Nikos Vaggalis | |||
Monday, 01 July 2024 | |||
Having faced doubt, debate and insecurity, Perl is still going after all those years, alive, kicking and making releases. Business as usual. The latest release of 5.40.0, went out on June 9th in a cumulative effort by the Perl 5 maintainers team. It comes with some new features and some others which matured into production status. The key ones are:
Let's take a better look. Try/catch was introduced in Perl 5.34 as: use feature 'try'; try { Version 5.36 completed it by adding the finally() block too. This brought it up to par with the rest of the OOP languages in terms of structured exception handling. However the feature was experimental which now moves out of and into production. The __CLASS__ keyword Perl officially got Classes in the core by implementing the coresponding OO syntax similar to the one you would find in other OOP programming languages. This was too introduced experimentally at an earlier version, that of 5.38. use v5. 38; class My::Example 1. 234 { method print_message { My::Example->new->print_message; The new addition is that of the __CLASS__ token which when invoked within a method, or similar location, such as a field initializer expression, it returns the name of the class of the invoking instance. Essentially it is equivalent to ref($self) except that it can additionally be used in a field initializer to gain access to class methods, before the instance is fully constructed. use feature 'class'; class Example1 { Since the talk is on Classes, there's been even further enchantments with the introduction of the field $name :reader; is equivalent to field $name; If you're familiar with Moose this would look like: use Moose; The ^^ operator Adding to the set of && and || operators, comes the new exclusive-or operator: $x ^^ $y and say "One of x or y is true, but not both"; Just a utility feature to simplify some operations. Next, for, iterating over multiple values at a time is no longer experimental. That means that you can now do : for my ($a, $b) ("apple", "banana", "orange", "lemon") { Finally, the builtin::inf, builtin::nan constants have been introduced which are equivalent to special floating point values infinity and Not a Number. These were the main additions. Of course there's always the usual bug fixes, CVE patching and performance improvements. Perl, is proven too resilient to die!
More InformationRelated ArticlesPerl 5.38.0 Released - An Appeal To New Blood?
To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.
Comments
or email your comment to: comments@i-programmer.info |
|||
Last Updated ( Wednesday, 03 July 2024 ) |