I just built perl v5.40.0 from source on Ubuntu, using the same steps as last time, without any build problems.
Note that perl v5.34 added try/catch syntax, inspired by Syntax::Keyword::Try:
use feature 'try';
try {
do_a_thing();
}
catch ( $e ) {
warn "It failed - $e";
}
while perl v5.36 further added finally blocks to try/catch, also inspired by Syntax::Keyword::Try:
use feature 'try';
try {
do_a_thing();
}
catch( $e ) { ... }
finally {
cleanup();
}
While updating my try-catch sample program from perl v5.38.2 to v5.40.0, I noticed that while
try-catch feature is no longer experimental with perl v5.40 its use with a finally block still emitted a warning ...
presumably because try and catch were added in perl v5.34, while finally was not added until perl v5.36
... so I expect the finally block warning will finally disappear in perl v5.42. :-)
Perl Feature References Added Later
Recent Features:
- try catch finally (perldoc)
- Syntax::Keyword::Try on CPAN by Paul Evans - a try/catch/finally syntax for perl
- Feature::Compat::Try on CPAN by Paul Evans - make try/catch syntax available (if the new syntax is available this module simply enables the core feature equivalent to using it directly; on older versions of perl before such syntax is available, it is provided instead using Syntax::Keyword::Try)
- Try::Tiny on CPAN by Karen Etheridge - minimal try/catch with proper preservation of $@
- perlclass (perldoc) - class, field, method
- Feature::Compat::Class on CPAN by Paul Evans - make class syntax available (a work-in-progress, like the underlying perlclass feature)
- Object::Pad on CPAN by Paul Evans - a simple syntax for lexical field-based objects
- What's New in Perl v5.40? Mohammad Sajid Anwar on perl.com (Jun 2024) : 1) new __CLASS__ keyword; 2) :reader attribute for field variables; 3) a space is permitted in the -M command-line option; 4) new ^^ logical xor operator; 5) try/catch feature is no longer experimental; 6) for iterating over multiple values at a time is no longer experimental
- builtin (perldoc) - Perl pragma to import built-in utility functions (introduced in perl v5.36)
- use builtin ':5.40' bundles true false weaken unweaken is_weak blessed refaddr reftype ceil floor is_tainted trim indexed
- Note: The overall builtin mechanism, as well as every individual function it provides, are currently experimental
Older Features:
- autodie (perldoc) - new core pragma added to perl v5.10.1
Basic Feature References:
- say feature - perl 5.10
- state feature - perl 5.10
- switch feature - perl 5.10: deprecated, removed in perl 5.42
- unicode_strings feature - perl 5.12
- unicode_eval and evalbytes features - perl 5.16
- current_sub feature - perl 5.16
- fc feature - perl 5.16
- lexical_subs feature - perl 5.26
- array_base feature - removed in perl 5.30
- postderef and postderef_qq features - perl 5.30
- signatures feature - perl 5.36
- refaliasing feature - perl 5.22 (still experimental)
- declared_refs feature - perl 5.26 (still experimental)
- ... Re^2: Passing argument by reference (for a scalar) by ikegami gives an example using refaliasing/declared_refs and compares to Data::Alias
- bitwise feature - perl 5.28
- isa feature - perl 5.36
- indirect feature - perl 5.32
- multidimensional feature - perl 5.34
- bareword_filehandles feature - perl 5.34
- try feature - perl 5.34
- builtin pragma - perl 5.36
- defer feature - perl 5.36
- extra_paired_delimiters feature - perl 5.36
- finally added to try feature - perl 5.36
- module_true feature - perl 5.38
- class feature - perl 5.38
- perl v5.40 feature bundle : bitwise current_sub evalbytes fc isa module_true postderef_qq say signatures state try unicode_eval unicode_strings
Feature switch Removal:
See Also