4 ms·
Perl 5's twofold approach to solving this mess is to use compile time checks to manage new features. The use VERSION syntax lets you specify a version of perl.
by daotoad 9y ago
Perl 5's twofold approach to solving this mess is to use compile time checks to manage new features. The use VERSION syntax lets you specify a version of perl. The feature pragma lets you enable or disable new features on a case by case basis. In my experience, this works really well.
The feature pragma (see https://perldoc.perl.org/feature.html https://perldoc.perl.org/feature.html) lets you manage new features on an individual basis. You just write: feature NAME_OF_FEATURE;. For example, feature signatures; In this case adding subroutine/method signature support. This is a compile time check.
If you don't want to hassle with enabling features on a piecemeal basis, you can also specify a version of perl you wish to rely on with use VERSION (see https://perldoc.perl.org/functions/use.html https://perldoc.perl.org/functions/use.html). For example, if want all of the standard features of perl 5.26.1, you say use v5.26.1.