summaryrefslogtreecommitdiff
path: root/systems/texlive/tlnet/tlpkg/tlperl/lib/feature.pm
diff options
context:
space:
mode:
Diffstat (limited to 'systems/texlive/tlnet/tlpkg/tlperl/lib/feature.pm')
-rw-r--r--systems/texlive/tlnet/tlpkg/tlperl/lib/feature.pm247
1 files changed, 160 insertions, 87 deletions
diff --git a/systems/texlive/tlnet/tlpkg/tlperl/lib/feature.pm b/systems/texlive/tlnet/tlpkg/tlperl/lib/feature.pm
index e6f467e9e4..5ebb4a3f78 100644
--- a/systems/texlive/tlnet/tlpkg/tlperl/lib/feature.pm
+++ b/systems/texlive/tlnet/tlpkg/tlperl/lib/feature.pm
@@ -5,34 +5,37 @@
package feature;
-our $VERSION = '1.58';
+our $VERSION = '1.64';
our %feature = (
- fc => 'feature_fc',
- isa => 'feature_isa',
- say => 'feature_say',
- state => 'feature_state',
- switch => 'feature_switch',
- bitwise => 'feature_bitwise',
- indirect => 'feature_indirect',
- evalbytes => 'feature_evalbytes',
- signatures => 'feature_signatures',
- current_sub => 'feature___SUB__',
- refaliasing => 'feature_refaliasing',
- postderef_qq => 'feature_postderef_qq',
- unicode_eval => 'feature_unieval',
- declared_refs => 'feature_myref',
- unicode_strings => 'feature_unicode',
+ fc => 'feature_fc',
+ isa => 'feature_isa',
+ say => 'feature_say',
+ try => 'feature_try',
+ state => 'feature_state',
+ switch => 'feature_switch',
+ bitwise => 'feature_bitwise',
+ indirect => 'feature_indirect',
+ evalbytes => 'feature_evalbytes',
+ signatures => 'feature_signatures',
+ current_sub => 'feature___SUB__',
+ refaliasing => 'feature_refaliasing',
+ postderef_qq => 'feature_postderef_qq',
+ unicode_eval => 'feature_unieval',
+ declared_refs => 'feature_myref',
+ unicode_strings => 'feature_unicode',
+ multidimensional => 'feature_multidimensional',
+ bareword_filehandles => 'feature_bareword_filehandles',
);
our %feature_bundle = (
- "5.10" => [qw(indirect say state switch)],
- "5.11" => [qw(indirect say state switch unicode_strings)],
- "5.15" => [qw(current_sub evalbytes fc indirect say state switch unicode_eval unicode_strings)],
- "5.23" => [qw(current_sub evalbytes fc indirect postderef_qq say state switch unicode_eval unicode_strings)],
- "5.27" => [qw(bitwise current_sub evalbytes fc indirect postderef_qq say state switch unicode_eval unicode_strings)],
- "all" => [qw(bitwise current_sub declared_refs evalbytes fc indirect isa postderef_qq refaliasing say signatures state switch unicode_eval unicode_strings)],
- "default" => [qw(indirect)],
+ "5.10" => [qw(bareword_filehandles indirect multidimensional say state switch)],
+ "5.11" => [qw(bareword_filehandles indirect multidimensional say state switch unicode_strings)],
+ "5.15" => [qw(bareword_filehandles current_sub evalbytes fc indirect multidimensional say state switch unicode_eval unicode_strings)],
+ "5.23" => [qw(bareword_filehandles current_sub evalbytes fc indirect multidimensional postderef_qq say state switch unicode_eval unicode_strings)],
+ "5.27" => [qw(bareword_filehandles bitwise current_sub evalbytes fc indirect multidimensional postderef_qq say state switch unicode_eval unicode_strings)],
+ "all" => [qw(bareword_filehandles bitwise current_sub declared_refs evalbytes fc indirect isa multidimensional postderef_qq refaliasing say signatures state switch try unicode_eval unicode_strings)],
+ "default" => [qw(bareword_filehandles indirect multidimensional)],
);
$feature_bundle{"5.12"} = $feature_bundle{"5.11"};
@@ -53,6 +56,8 @@ $feature_bundle{"5.29"} = $feature_bundle{"5.27"};
$feature_bundle{"5.30"} = $feature_bundle{"5.27"};
$feature_bundle{"5.31"} = $feature_bundle{"5.27"};
$feature_bundle{"5.32"} = $feature_bundle{"5.27"};
+$feature_bundle{"5.33"} = $feature_bundle{"5.27"};
+$feature_bundle{"5.34"} = $feature_bundle{"5.27"};
$feature_bundle{"5.9.5"} = $feature_bundle{"5.10"};
my %noops = (
postderef => 1,
@@ -63,7 +68,7 @@ my %removed = (
);
our $hint_shift = 26;
-our $hint_mask = 0x1c000000;
+our $hint_mask = 0x3c000000;
our @hint_bundles = qw( default 5.10 5.11 5.15 5.23 5.27 );
# This gets set (for now) in $^H as well as in %^H,
@@ -80,18 +85,20 @@ feature - Perl pragma to enable new features
=head1 SYNOPSIS
- use feature qw(say switch);
- given ($foo) {
- when (1) { say "\$foo == 1" }
- when ([2,3]) { say "\$foo == 2 || \$foo == 3" }
- when (/^a[bc]d$/) { say "\$foo eq 'abd' || \$foo eq 'acd'" }
- when ($_ > 100) { say "\$foo > 100" }
- default { say "None of the above" }
- }
+ use feature qw(fc say);
+
+ # Without the "use feature" above, this code would not be able to find
+ # the built-ins "say" or "fc":
+ say "The case-folded version of $x is: " . fc $x;
+
+
+ # set features to match the :5.10 bundle, which may turn off or on
+ # multiple features (see below)
+ use feature ':5.10';
- use feature ':5.10'; # loads all features available in perl 5.10
- use v5.10; # implicitly loads :5.10 feature bundle
+ # implicitly loads :5.10 feature bundle
+ use v5.10;
=head1 DESCRIPTION
@@ -135,7 +142,7 @@ disable I<all> features (an unusual request!) use C<no feature ':all'>.
=head2 The 'say' feature
-C<use feature 'say'> tells the compiler to enable the Perl 6 style
+C<use feature 'say'> tells the compiler to enable the Raku-inspired
C<say> function.
See L<perlfunc/say> for details.
@@ -153,13 +160,13 @@ This feature is available starting with Perl 5.10.
=head2 The 'switch' feature
-B<WARNING>: Because the L<smartmatch operator|perlop/"Smartmatch Operator"> is
-experimental, Perl will warn when you use this feature, unless you have
-explicitly disabled the warning:
+B<WARNING>: This feature is still experimental and the implementation may
+change or be removed in future versions of Perl. For this reason, Perl will
+warn when you use the feature, unless you have explicitly disabled the warning:
no warnings "experimental::smartmatch";
-C<use feature 'switch'> tells the compiler to enable the Perl 6
+C<use feature 'switch'> tells the compiler to enable the Raku
given/when construct.
See L<perlsyn/"Switch Statements"> for details.
@@ -282,9 +289,8 @@ regardless of what feature declarations are in scope.
=head2 The 'signatures' feature
B<WARNING>: This feature is still experimental and the implementation may
-change in future versions of Perl. For this reason, Perl will
-warn when you use the feature, unless you have explicitly disabled the
-warning:
+change or be removed in future versions of Perl. For this reason, Perl will
+warn when you use the feature, unless you have explicitly disabled the warning:
no warnings "experimental::signatures";
@@ -302,9 +308,8 @@ This feature is available from Perl 5.20 onwards.
=head2 The 'refaliasing' feature
B<WARNING>: This feature is still experimental and the implementation may
-change in future versions of Perl. For this reason, Perl will
-warn when you use the feature, unless you have explicitly disabled the
-warning:
+change or be removed in future versions of Perl. For this reason, Perl will
+warn when you use the feature, unless you have explicitly disabled the warning:
no warnings "experimental::refaliasing";
@@ -339,9 +344,8 @@ category.
=head2 The 'declared_refs' feature
B<WARNING>: This feature is still experimental and the implementation may
-change in future versions of Perl. For this reason, Perl will
-warn when you use the feature, unless you have explicitly disabled the
-warning:
+change or be removed in future versions of Perl. For this reason, Perl will
+warn when you use the feature, unless you have explicitly disabled the warning:
no warnings "experimental::declared_refs";
@@ -354,6 +358,12 @@ This feature is available from Perl 5.26 onwards.
=head2 The 'isa' feature
+B<WARNING>: This feature is still experimental and the implementation may
+change or be removed in future versions of Perl. For this reason, Perl will
+warn when you use the feature, unless you have explicitly disabled the warning:
+
+ no warnings "experimental::isa";
+
This allows the use of the C<isa> infix operator, which tests whether the
scalar given by the left operand is an object of the class given by the
right operand. See L<perlop/Class Instance Operator> for more details.
@@ -372,61 +382,124 @@ previous versions, it was simply on all the time. To disallow (or
warn on) indirect object syntax on older Perls, see the L<indirect>
CPAN module.
-=head1 FEATURE BUNDLES
+=head2 The 'multidimensional' feature
-It's possible to load multiple features together, using
-a I<feature bundle>. The name of a feature bundle is prefixed with
-a colon, to distinguish it from an actual feature.
+This feature enables multidimensional array emulation, a perl 4 (or
+earlier) feature that was used to emulate multidimensional arrays with
+hashes. This works by converting code like C<< $foo{$x, $y} >> into
+C<< $foo{join($;, $x, $y)} >>. It is enabled by default, but can be
+turned off to disable multidimensional array emulation.
- use feature ":5.10";
+When this feature is disabled the syntax that is normally replaced
+will report a compilation error.
-The following feature bundles are available:
+This feature is available under this name from Perl 5.34 onwards. In
+previous versions, it was simply on all the time.
- bundle features included
- --------- -----------------
- :default indirect
+You can use the L<multidimensional> module on CPAN to disable
+multidimensional array emulation for older versions of Perl.
- :5.10 say state switch indirect
+=head2 The 'bareword_filehandles' feature.
- :5.12 say state switch unicode_strings indirect
+This feature enables bareword filehandles for builtin functions
+operations, a generally discouraged practice. It is enabled by
+default, but can be turned off to disable bareword filehandles, except
+for the exceptions listed below.
- :5.14 say state switch unicode_strings indirect
+The perl built-in filehandles C<STDIN>, C<STDOUT>, C<STDERR>, C<DATA>,
+C<ARGV>, C<ARGVOUT> and the special C<_> are always enabled.
- :5.16 say state switch unicode_strings
- unicode_eval evalbytes current_sub fc
- indirect
+This feature is enabled under this name from Perl 5.34 onwards. In
+previous versions it was simply on all the time.
- :5.18 say state switch unicode_strings
- unicode_eval evalbytes current_sub fc
- indirect
+You can use the L<bareword::filehandles> module on CPAN to disable
+bareword filehandles for older versions of perl.
- :5.20 say state switch unicode_strings
- unicode_eval evalbytes current_sub fc
- indirect
+=head2 The 'try' feature.
+
+B<WARNING>: This feature is still experimental and the implementation may
+change or be removed in future versions of Perl. For this reason, Perl will
+warn when you use the feature, unless you have explicitly disabled the warning:
- :5.22 say state switch unicode_strings
- unicode_eval evalbytes current_sub fc
- indirect
+ no warnings "experimental::try";
- :5.24 say state switch unicode_strings
- unicode_eval evalbytes current_sub fc
- postderef_qq indirect
+This feature enables the C<try> and C<catch> syntax, which allows exception
+handling, where exceptions thrown from the body of the block introduced with
+C<try> are caught by executing the body of the C<catch> block.
+
+For more information, see L<perlsyn/"Try Catch Exception Handling">.
+
+=head1 FEATURE BUNDLES
- :5.26 say state switch unicode_strings
- unicode_eval evalbytes current_sub fc
- postderef_qq indirect
+It's possible to load multiple features together, using
+a I<feature bundle>. The name of a feature bundle is prefixed with
+a colon, to distinguish it from an actual feature.
- :5.28 say state switch unicode_strings
- unicode_eval evalbytes current_sub fc
- postderef_qq bitwise indirect
+ use feature ":5.10";
- :5.30 say state switch unicode_strings
- unicode_eval evalbytes current_sub fc
- postderef_qq bitwise indirect
+The following feature bundles are available:
- :5.32 say state switch unicode_strings
- unicode_eval evalbytes current_sub fc
- postderef_qq bitwise indirect
+ bundle features included
+ --------- -----------------
+ :default indirect multidimensional
+ bareword_filehandles
+
+ :5.10 bareword_filehandles indirect
+ multidimensional say state switch
+
+ :5.12 bareword_filehandles indirect
+ multidimensional say state switch
+ unicode_strings
+
+ :5.14 bareword_filehandles indirect
+ multidimensional say state switch
+ unicode_strings
+
+ :5.16 bareword_filehandles current_sub evalbytes
+ fc indirect multidimensional say state
+ switch unicode_eval unicode_strings
+
+ :5.18 bareword_filehandles current_sub evalbytes
+ fc indirect multidimensional say state
+ switch unicode_eval unicode_strings
+
+ :5.20 bareword_filehandles current_sub evalbytes
+ fc indirect multidimensional say state
+ switch unicode_eval unicode_strings
+
+ :5.22 bareword_filehandles current_sub evalbytes
+ fc indirect multidimensional say state
+ switch unicode_eval unicode_strings
+
+ :5.24 bareword_filehandles current_sub evalbytes
+ fc indirect multidimensional postderef_qq
+ say state switch unicode_eval
+ unicode_strings
+
+ :5.26 bareword_filehandles current_sub evalbytes
+ fc indirect multidimensional postderef_qq
+ say state switch unicode_eval
+ unicode_strings
+
+ :5.28 bareword_filehandles bitwise current_sub
+ evalbytes fc indirect multidimensional
+ postderef_qq say state switch unicode_eval
+ unicode_strings
+
+ :5.30 bareword_filehandles bitwise current_sub
+ evalbytes fc indirect multidimensional
+ postderef_qq say state switch unicode_eval
+ unicode_strings
+
+ :5.32 bareword_filehandles bitwise current_sub
+ evalbytes fc indirect multidimensional
+ postderef_qq say state switch unicode_eval
+ unicode_strings
+
+ :5.34 bareword_filehandles bitwise current_sub
+ evalbytes fc indirect multidimensional
+ postderef_qq say state switch unicode_eval
+ unicode_strings
The C<:default> bundle represents the feature set that is enabled before
any C<use feature> or C<no feature> declaration.