This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
55ee7332f58c685c90001c504a012bd961445de0
[perl5.git] / lib / feature.pm
1 # -*- buffer-read-only: t -*-
2 # !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
3 # This file is built by regen/feature.pl.
4 # Any changes made here will be lost!
5
6 package feature;
7
8 our $VERSION = '1.71';
9
10 our %feature = (
11     fc                      => 'feature_fc',
12     isa                     => 'feature_isa',
13     say                     => 'feature_say',
14     try                     => 'feature_try',
15     defer                   => 'feature_defer',
16     state                   => 'feature_state',
17     switch                  => 'feature_switch',
18     bitwise                 => 'feature_bitwise',
19     indirect                => 'feature_indirect',
20     evalbytes               => 'feature_evalbytes',
21     signatures              => 'feature_signatures',
22     current_sub             => 'feature___SUB__',
23     refaliasing             => 'feature_refaliasing',
24     postderef_qq            => 'feature_postderef_qq',
25     unicode_eval            => 'feature_unieval',
26     declared_refs           => 'feature_myref',
27     unicode_strings         => 'feature_unicode',
28     multidimensional        => 'feature_multidimensional',
29     bareword_filehandles    => 'feature_bareword_filehandles',
30     extra_paired_delimiters => 'feature_more_delims',
31 );
32
33 our %feature_bundle = (
34     "5.10"    => [qw(bareword_filehandles indirect multidimensional say state switch)],
35     "5.11"    => [qw(bareword_filehandles indirect multidimensional say state switch unicode_strings)],
36     "5.15"    => [qw(bareword_filehandles current_sub evalbytes fc indirect multidimensional say state switch unicode_eval unicode_strings)],
37     "5.23"    => [qw(bareword_filehandles current_sub evalbytes fc indirect multidimensional postderef_qq say state switch unicode_eval unicode_strings)],
38     "5.27"    => [qw(bareword_filehandles bitwise current_sub evalbytes fc indirect multidimensional postderef_qq say state switch unicode_eval unicode_strings)],
39     "5.35"    => [qw(bitwise current_sub evalbytes fc isa postderef_qq say signatures state unicode_eval unicode_strings)],
40     "all"     => [qw(bareword_filehandles bitwise current_sub declared_refs defer evalbytes extra_paired_delimiters fc indirect isa multidimensional postderef_qq refaliasing say signatures state switch try unicode_eval unicode_strings)],
41     "default" => [qw(bareword_filehandles indirect multidimensional)],
42 );
43
44 $feature_bundle{"5.12"} = $feature_bundle{"5.11"};
45 $feature_bundle{"5.13"} = $feature_bundle{"5.11"};
46 $feature_bundle{"5.14"} = $feature_bundle{"5.11"};
47 $feature_bundle{"5.16"} = $feature_bundle{"5.15"};
48 $feature_bundle{"5.17"} = $feature_bundle{"5.15"};
49 $feature_bundle{"5.18"} = $feature_bundle{"5.15"};
50 $feature_bundle{"5.19"} = $feature_bundle{"5.15"};
51 $feature_bundle{"5.20"} = $feature_bundle{"5.15"};
52 $feature_bundle{"5.21"} = $feature_bundle{"5.15"};
53 $feature_bundle{"5.22"} = $feature_bundle{"5.15"};
54 $feature_bundle{"5.24"} = $feature_bundle{"5.23"};
55 $feature_bundle{"5.25"} = $feature_bundle{"5.23"};
56 $feature_bundle{"5.26"} = $feature_bundle{"5.23"};
57 $feature_bundle{"5.28"} = $feature_bundle{"5.27"};
58 $feature_bundle{"5.29"} = $feature_bundle{"5.27"};
59 $feature_bundle{"5.30"} = $feature_bundle{"5.27"};
60 $feature_bundle{"5.31"} = $feature_bundle{"5.27"};
61 $feature_bundle{"5.32"} = $feature_bundle{"5.27"};
62 $feature_bundle{"5.33"} = $feature_bundle{"5.27"};
63 $feature_bundle{"5.34"} = $feature_bundle{"5.27"};
64 $feature_bundle{"5.36"} = $feature_bundle{"5.35"};
65 $feature_bundle{"5.9.5"} = $feature_bundle{"5.10"};
66 my %noops = (
67     postderef => 1,
68     lexical_subs => 1,
69 );
70 my %removed = (
71     array_base => 1,
72 );
73
74 our $hint_shift   = 26;
75 our $hint_mask    = 0x3c000000;
76 our @hint_bundles = qw( default 5.10 5.11 5.15 5.23 5.27 5.35 );
77
78 # This gets set (for now) in $^H as well as in %^H,
79 # for runtime speed of the uc/lc/ucfirst/lcfirst functions.
80 # See HINT_UNI_8_BIT in perl.h.
81 our $hint_uni8bit = 0x00000800;
82
83 # TODO:
84 # - think about versioned features (use feature switch => 2)
85
86 =encoding utf8
87
88 =head1 NAME
89
90 feature - Perl pragma to enable new features
91
92 =head1 SYNOPSIS
93
94     use feature qw(fc say);
95
96     # Without the "use feature" above, this code would not be able to find
97     # the built-ins "say" or "fc":
98     say "The case-folded version of $x is: " . fc $x;
99
100
101     # set features to match the :5.10 bundle, which may turn off or on
102     # multiple features (see below)
103     use feature ':5.10';
104
105
106     # implicitly loads :5.10 feature bundle
107     use v5.10;
108
109 =head1 DESCRIPTION
110
111 It is usually impossible to add new syntax to Perl without breaking
112 some existing programs.  This pragma provides a way to minimize that
113 risk. New syntactic constructs, or new semantic meanings to older
114 constructs, can be enabled by C<use feature 'foo'>, and will be parsed
115 only when the appropriate feature pragma is in scope.  (Nevertheless, the
116 C<CORE::> prefix provides access to all Perl keywords, regardless of this
117 pragma.)
118
119 =head2 Lexical effect
120
121 Like other pragmas (C<use strict>, for example), features have a lexical
122 effect.  C<use feature qw(foo)> will only make the feature "foo" available
123 from that point to the end of the enclosing block.
124
125     {
126         use feature 'say';
127         say "say is available here";
128     }
129     print "But not here.\n";
130
131 =head2 C<no feature>
132
133 Features can also be turned off by using C<no feature "foo">.  This too
134 has lexical effect.
135
136     use feature 'say';
137     say "say is available here";
138     {
139         no feature 'say';
140         print "But not here.\n";
141     }
142     say "Yet it is here.";
143
144 C<no feature> with no features specified will reset to the default group.  To
145 disable I<all> features (an unusual request!) use C<no feature ':all'>.
146
147 =head1 AVAILABLE FEATURES
148
149 =head2 The 'say' feature
150
151 C<use feature 'say'> tells the compiler to enable the Raku-inspired
152 C<say> function.
153
154 See L<perlfunc/say> for details.
155
156 This feature is available starting with Perl 5.10.
157
158 =head2 The 'state' feature
159
160 C<use feature 'state'> tells the compiler to enable C<state>
161 variables.
162
163 See L<perlsub/"Persistent Private Variables"> for details.
164
165 This feature is available starting with Perl 5.10.
166
167 =head2 The 'switch' feature
168
169 B<WARNING>: This feature is still experimental and the implementation may
170 change or be removed in future versions of Perl.  For this reason, Perl will
171 warn when you use the feature, unless you have explicitly disabled the warning:
172
173     no warnings "experimental::smartmatch";
174
175 C<use feature 'switch'> tells the compiler to enable the Raku
176 given/when construct.
177
178 See L<perlsyn/"Switch Statements"> for details.
179
180 This feature is available starting with Perl 5.10.
181
182 =head2 The 'unicode_strings' feature
183
184 C<use feature 'unicode_strings'> tells the compiler to use Unicode rules
185 in all string operations executed within its scope (unless they are also
186 within the scope of either C<use locale> or C<use bytes>).  The same applies
187 to all regular expressions compiled within the scope, even if executed outside
188 it.  It does not change the internal representation of strings, but only how
189 they are interpreted.
190
191 C<no feature 'unicode_strings'> tells the compiler to use the traditional
192 Perl rules wherein the native character set rules is used unless it is
193 clear to Perl that Unicode is desired.  This can lead to some surprises
194 when the behavior suddenly changes.  (See
195 L<perlunicode/The "Unicode Bug"> for details.)  For this reason, if you are
196 potentially using Unicode in your program, the
197 C<use feature 'unicode_strings'> subpragma is B<strongly> recommended.
198
199 This feature is available starting with Perl 5.12; was almost fully
200 implemented in Perl 5.14; and extended in Perl 5.16 to cover C<quotemeta>;
201 was extended further in Perl 5.26 to cover L<the range
202 operator|perlop/Range Operators>; and was extended again in Perl 5.28 to
203 cover L<special-cased whitespace splitting|perlfunc/split>.
204
205 =head2 The 'unicode_eval' and 'evalbytes' features
206
207 Together, these two features are intended to replace the legacy string
208 C<eval> function, which behaves problematically in some instances.  They are
209 available starting with Perl 5.16, and are enabled by default by a
210 S<C<use 5.16>> or higher declaration.
211
212 C<unicode_eval> changes the behavior of plain string C<eval> to work more
213 consistently, especially in the Unicode world.  Certain (mis)behaviors
214 couldn't be changed without breaking some things that had come to rely on
215 them, so the feature can be enabled and disabled.  Details are at
216 L<perlfunc/Under the "unicode_eval" feature>.
217
218 C<evalbytes> is like string C<eval>, but it treats its argument as a byte
219 string. Details are at L<perlfunc/evalbytes EXPR>.  Without a
220 S<C<use feature 'evalbytes'>> nor a S<C<use v5.16>> (or higher) declaration in
221 the current scope, you can still access it by instead writing
222 C<CORE::evalbytes>.
223
224 =head2 The 'current_sub' feature
225
226 This provides the C<__SUB__> token that returns a reference to the current
227 subroutine or C<undef> outside of a subroutine.
228
229 This feature is available starting with Perl 5.16.
230
231 =head2 The 'array_base' feature
232
233 This feature supported the legacy C<$[> variable.  See L<perlvar/$[>.
234 It was on by default but disabled under C<use v5.16> (see
235 L</IMPLICIT LOADING>, below) and unavailable since perl 5.30.
236
237 This feature is available under this name starting with Perl 5.16.  In
238 previous versions, it was simply on all the time, and this pragma knew
239 nothing about it.
240
241 =head2 The 'fc' feature
242
243 C<use feature 'fc'> tells the compiler to enable the C<fc> function,
244 which implements Unicode casefolding.
245
246 See L<perlfunc/fc> for details.
247
248 This feature is available from Perl 5.16 onwards.
249
250 =head2 The 'lexical_subs' feature
251
252 In Perl versions prior to 5.26, this feature enabled
253 declaration of subroutines via C<my sub foo>, C<state sub foo>
254 and C<our sub foo> syntax.  See L<perlsub/Lexical Subroutines> for details.
255
256 This feature is available from Perl 5.18 onwards.  From Perl 5.18 to 5.24,
257 it was classed as experimental, and Perl emitted a warning for its
258 usage, except when explicitly disabled:
259
260   no warnings "experimental::lexical_subs";
261
262 As of Perl 5.26, use of this feature no longer triggers a warning, though
263 the C<experimental::lexical_subs> warning category still exists (for
264 compatibility with code that disables it).  In addition, this syntax is
265 not only no longer experimental, but it is enabled for all Perl code,
266 regardless of what feature declarations are in scope.
267
268 =head2 The 'postderef' and 'postderef_qq' features
269
270 The 'postderef_qq' feature extends the applicability of L<postfix
271 dereference syntax|perlref/Postfix Dereference Syntax> so that postfix array
272 and scalar dereference are available in double-quotish interpolations. For
273 example, it makes the following two statements equivalent:
274
275   my $s = "[@{ $h->{a} }]";
276   my $s = "[$h->{a}->@*]";
277
278 This feature is available from Perl 5.20 onwards. In Perl 5.20 and 5.22, it
279 was classed as experimental, and Perl emitted a warning for its
280 usage, except when explicitly disabled:
281
282   no warnings "experimental::postderef";
283
284 As of Perl 5.24, use of this feature no longer triggers a warning, though
285 the C<experimental::postderef> warning category still exists (for
286 compatibility with code that disables it).
287
288 The 'postderef' feature was used in Perl 5.20 and Perl 5.22 to enable
289 postfix dereference syntax outside double-quotish interpolations. In those
290 versions, using it triggered the C<experimental::postderef> warning in the
291 same way as the 'postderef_qq' feature did. As of Perl 5.24, this syntax is
292 not only no longer experimental, but it is enabled for all Perl code,
293 regardless of what feature declarations are in scope.
294
295 =head2 The 'signatures' feature
296
297 This enables syntax for declaring subroutine arguments as lexical variables.
298 For example, for this subroutine:
299
300     sub foo ($left, $right) {
301         return $left + $right;
302     }
303
304 Calling C<foo(3, 7)> will assign C<3> into C<$left> and C<7> into C<$right>.
305
306 See L<perlsub/Signatures> for details.
307
308 This feature is available from Perl 5.20 onwards. From Perl 5.20 to 5.34,
309 it was classed as experimental, and Perl emitted a warning for its usage,
310 except when explicitly disabled:
311
312   no warnings "experimental::signatures";
313
314 As of Perl 5.36, use of this feature no longer triggers a warning, though the
315 C<experimental::signatures> warning category still exists (for compatibility
316 with code that disables it). This feature is now considered stable, and is
317 enabled automatically by C<use v5.36> (or higher).
318
319 =head2 The 'refaliasing' feature
320
321 B<WARNING>: This feature is still experimental and the implementation may
322 change or be removed in future versions of Perl.  For this reason, Perl will
323 warn when you use the feature, unless you have explicitly disabled the warning:
324
325     no warnings "experimental::refaliasing";
326
327 This enables aliasing via assignment to references:
328
329     \$a = \$b; # $a and $b now point to the same scalar
330     \@a = \@b; #                     to the same array
331     \%a = \%b;
332     \&a = \&b;
333     foreach \%hash (@array_of_hash_refs) {
334         ...
335     }
336
337 See L<perlref/Assigning to References> for details.
338
339 This feature is available from Perl 5.22 onwards.
340
341 =head2 The 'bitwise' feature
342
343 This makes the four standard bitwise operators (C<& | ^ ~>) treat their
344 operands consistently as numbers, and introduces four new dotted operators
345 (C<&. |. ^. ~.>) that treat their operands consistently as strings.  The
346 same applies to the assignment variants (C<&= |= ^= &.= |.= ^.=>).
347
348 See L<perlop/Bitwise String Operators> for details.
349
350 This feature is available from Perl 5.22 onwards.  Starting in Perl 5.28,
351 C<use v5.28> will enable the feature.  Before 5.28, it was still
352 experimental and would emit a warning in the "experimental::bitwise"
353 category.
354
355 =head2 The 'declared_refs' feature
356
357 B<WARNING>: This feature is still experimental and the implementation may
358 change or be removed in future versions of Perl.  For this reason, Perl will
359 warn when you use the feature, unless you have explicitly disabled the warning:
360
361     no warnings "experimental::declared_refs";
362
363 This allows a reference to a variable to be declared with C<my>, C<state>,
364 our C<our>, or localized with C<local>.  It is intended mainly for use in
365 conjunction with the "refaliasing" feature.  See L<perlref/Declaring a
366 Reference to a Variable> for examples.
367
368 This feature is available from Perl 5.26 onwards.
369
370 =head2 The 'isa' feature
371
372 This allows the use of the C<isa> infix operator, which tests whether the
373 scalar given by the left operand is an object of the class given by the
374 right operand. See L<perlop/Class Instance Operator> for more details.
375
376 This feature is available from Perl 5.32 onwards.  From Perl 5.32 to 5.34,
377 it was classed as experimental, and Perl emitted a warning for its usage,
378 except when explicitly disabled:
379
380     no warnings "experimental::isa";
381
382 As of Perl 5.36, use of this feature no longer triggers a warning (though the
383 C<experimental::isa> warning category stilll exists for compatibility with
384 code that disables it). This feature is now considered stable, and is enabled
385 automatically by C<use v5.36> (or higher).
386
387 =head2 The 'indirect' feature
388
389 This feature allows the use of L<indirect object
390 syntax|perlobj/Indirect Object Syntax> for method calls, e.g.  C<new
391 Foo 1, 2;>. It is enabled by default, but can be turned off to
392 disallow indirect object syntax.
393
394 This feature is available under this name from Perl 5.32 onwards. In
395 previous versions, it was simply on all the time.  To disallow (or
396 warn on) indirect object syntax on older Perls, see the L<indirect>
397 CPAN module.
398
399 =head2 The 'multidimensional' feature
400
401 This feature enables multidimensional array emulation, a perl 4 (or
402 earlier) feature that was used to emulate multidimensional arrays with
403 hashes.  This works by converting code like C<< $foo{$x, $y} >> into
404 C<< $foo{join($;, $x, $y)} >>.  It is enabled by default, but can be
405 turned off to disable multidimensional array emulation.
406
407 When this feature is disabled the syntax that is normally replaced
408 will report a compilation error.
409
410 This feature is available under this name from Perl 5.34 onwards. In
411 previous versions, it was simply on all the time.
412
413 You can use the L<multidimensional> module on CPAN to disable
414 multidimensional array emulation for older versions of Perl.
415
416 =head2 The 'bareword_filehandles' feature.
417
418 This feature enables bareword filehandles for builtin functions
419 operations, a generally discouraged practice.  It is enabled by
420 default, but can be turned off to disable bareword filehandles, except
421 for the exceptions listed below.
422
423 The perl built-in filehandles C<STDIN>, C<STDOUT>, C<STDERR>, C<DATA>,
424 C<ARGV>, C<ARGVOUT> and the special C<_> are always enabled.
425
426 This behavior was always present in versions before Perl 5.34.  In Perl 5.34,
427 it was made controllable with the C<feature> pragma, but was on by default.
428 It is not present in the C<:5.36> feature bundle, so C<use v5.36> disables
429 this feature.
430
431 You can use the L<bareword::filehandles> module on CPAN to disable
432 bareword filehandles for older versions of perl.
433
434 =head2 The 'try' feature.
435
436 B<WARNING>: This feature is still experimental and the implementation may
437 change or be removed in future versions of Perl.  For this reason, Perl will
438 warn when you use the feature, unless you have explicitly disabled the warning:
439
440     no warnings "experimental::try";
441
442 This feature enables the C<try> and C<catch> syntax, which allows exception
443 handling, where exceptions thrown from the body of the block introduced with
444 C<try> are caught by executing the body of the C<catch> block.
445
446 For more information, see L<perlsyn/"Try Catch Exception Handling">.
447
448 =head2 The 'defer' feature
449
450 This feature enables the C<defer> block syntax, which allows a block of code
451 to be deferred until when the flow of control leaves the block which contained
452 it. For more details, see L<perlsyn/defer>.
453
454 =head2 The 'extra_paired_delimiters' feature
455
456 B<WARNING>: This feature is still experimental and the implementation may
457 change or be removed in future versions of Perl.  For this reason, Perl will
458 warn when you use the feature, unless you have explicitly disabled the warning:
459
460     no warnings "experimental::extra_paired_delimiters";
461
462 This feature enables the use of more paired string delimiters than the
463 traditional four, S<C<< <  > >>>, S<C<( )>>, S<C<{ }>>, and S<C<[ ]>>.  When
464 this feature is on, for example, you can say S<C<qrE<171>patE<187>>>.
465
466 This feature is available starting in Perl 5.36.
467
468 The complete list of accepted paired delimiters as of Unicode 14.0 is:
469
470  (  )    U+0028, U+0029   LEFT/RIGHT PARENTHESIS
471  <  >    U+003C, U+003E   LESS-THAN/GREATER-THAN SIGN
472  [  ]    U+005B, U+005D   LEFT/RIGHT SQUARE BRACKET
473  {  }    U+007B, U+007D   LEFT/RIGHT CURLY BRACKET
474  «  »    U+00AB, U+00BB   LEFT/RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK
475  »  «    U+00BB, U+00AB   RIGHT/LEFT-POINTING DOUBLE ANGLE QUOTATION MARK
476  ܆  ܇    U+0706, U+0707   SYRIAC COLON SKEWED LEFT/RIGHT
477  ༺  ༻    U+0F3A, U+0F3B   TIBETAN MARK GUG RTAGS GYON,  TIBETAN MARK GUG
478                           RTAGS GYAS
479  ༼  ༽    U+0F3C, U+0F3D   TIBETAN MARK ANG KHANG GYON,  TIBETAN MARK ANG
480                           KHANG GYAS
481  ᚛  ᚜    U+169B, U+169C   OGHAM FEATHER MARK,  OGHAM REVERSED FEATHER MARK
482  ‘  ’    U+2018, U+2019   LEFT/RIGHT SINGLE QUOTATION MARK
483  ’  ‘    U+2019, U+2018   RIGHT/LEFT SINGLE QUOTATION MARK
484  “  ”    U+201C, U+201D   LEFT/RIGHT DOUBLE QUOTATION MARK
485  ”  “    U+201D, U+201C   RIGHT/LEFT DOUBLE QUOTATION MARK
486  ‵  ′    U+2035, U+2032   REVERSED PRIME,  PRIME
487  ‶  ″    U+2036, U+2033   REVERSED DOUBLE PRIME,  DOUBLE PRIME
488  ‷  ‴    U+2037, U+2034   REVERSED TRIPLE PRIME,  TRIPLE PRIME
489  ‹  ›    U+2039, U+203A   SINGLE LEFT/RIGHT-POINTING ANGLE QUOTATION MARK
490  ›  ‹    U+203A, U+2039   SINGLE RIGHT/LEFT-POINTING ANGLE QUOTATION MARK
491  ⁅  ⁆    U+2045, U+2046   LEFT/RIGHT SQUARE BRACKET WITH QUILL
492  ⁽  ⁾    U+207D, U+207E   SUPERSCRIPT LEFT/RIGHT PARENTHESIS
493  ₍  ₎    U+208D, U+208E   SUBSCRIPT LEFT/RIGHT PARENTHESIS
494  ≤  ≥    U+2264, U+2265   LESS-THAN/GREATER-THAN OR EQUAL TO
495  ≦  ≧    U+2266, U+2267   LESS-THAN/GREATER-THAN OVER EQUAL TO
496  ≨  ≩    U+2268, U+2269   LESS-THAN/GREATER-THAN BUT NOT EQUAL TO
497  ≪  ≫    U+226A, U+226B   MUCH LESS-THAN/GREATER-THAN
498  ≮  ≯    U+226E, U+226F   NOT LESS-THAN/GREATER-THAN
499  ≰  ≱    U+2270, U+2271   NEITHER LESS-THAN/GREATER-THAN NOR EQUAL TO
500  ≲  ≳    U+2272, U+2273   LESS-THAN/GREATER-THAN OR EQUIVALENT TO
501  ≴  ≵    U+2274, U+2275   NEITHER LESS-THAN/GREATER-THAN NOR EQUIVALENT TO
502  ≺  ≻    U+227A, U+227B   PRECEDES/SUCCEEDS
503  ≼  ≽    U+227C, U+227D   PRECEDES/SUCCEEDS OR EQUAL TO
504  ≾  ≿    U+227E, U+227F   PRECEDES/SUCCEEDS OR EQUIVALENT TO
505  ⊀  ⊁    U+2280, U+2281   DOES NOT PRECEDE/SUCCEED
506  ⊂  ⊃    U+2282, U+2283   SUBSET/SUPERSET OF
507  ⊄  ⊅    U+2284, U+2285   NOT A SUBSET/SUPERSET OF
508  ⊆  ⊇    U+2286, U+2287   SUBSET/SUPERSET OF OR EQUAL TO
509  ⊈  ⊉    U+2288, U+2289   NEITHER A SUBSET/SUPERSET OF NOR EQUAL TO
510  ⊊  ⊋    U+228A, U+228B   SUBSET/SUPERSET OF WITH NOT EQUAL TO
511  ⊰  ⊱    U+22B0, U+22B1   PRECEDES/SUCCEEDS UNDER RELATION
512  ⋐  ⋑    U+22D0, U+22D1   DOUBLE SUBSET/SUPERSET
513  ⋖  ⋗    U+22D6, U+22D7   LESS-THAN/GREATER-THAN WITH DOT
514  ⋘  ⋙    U+22D8, U+22D9   VERY MUCH LESS-THAN/GREATER-THAN
515  ⋜  ⋝    U+22DC, U+22DD   EQUAL TO OR LESS-THAN/GREATER-THAN
516  ⋞  ⋟    U+22DE, U+22DF   EQUAL TO OR PRECEDES/SUCCEEDS
517  ⋠  ⋡    U+22E0, U+22E1   DOES NOT PRECEDE/SUCCEED OR EQUAL
518  ⋦  ⋧    U+22E6, U+22E7   LESS-THAN/GREATER-THAN BUT NOT EQUIVALENT TO
519  ⋨  ⋩    U+22E8, U+22E9   PRECEDES/SUCCEEDS BUT NOT EQUIVALENT TO
520  ⌈  ⌉    U+2308, U+2309   LEFT/RIGHT CEILING
521  ⌊  ⌋    U+230A, U+230B   LEFT/RIGHT FLOOR
522  〈 〉   U+2329, U+232A   LEFT/RIGHT-POINTING ANGLE BRACKET
523  ❨  ❩    U+2768, U+2769   MEDIUM LEFT/RIGHT PARENTHESIS ORNAMENT
524  ❪  ❫    U+276A, U+276B   MEDIUM FLATTENED LEFT/RIGHT PARENTHESIS ORNAMENT
525  ❬  ❭    U+276C, U+276D   MEDIUM LEFT/RIGHT-POINTING ANGLE BRACKET
526                           ORNAMENT
527  ❮  ❯    U+276E, U+276F   HEAVY LEFT/RIGHT-POINTING ANGLE QUOTATION MARK
528                           ORNAMENT
529  ❰  ❱    U+2770, U+2771   HEAVY LEFT/RIGHT-POINTING ANGLE BRACKET ORNAMENT
530  ❲  ❳    U+2772, U+2773   LIGHT LEFT/RIGHT TORTOISE SHELL BRACKET ORNAMENT
531  ❴  ❵    U+2774, U+2775   MEDIUM LEFT/RIGHT CURLY BRACKET ORNAMENT
532  ⟃  ⟄    U+27C3, U+27C4   OPEN SUBSET/SUPERSET
533  ⟅  ⟆    U+27C5, U+27C6   LEFT/RIGHT S-SHAPED BAG DELIMITER
534  ⟈  ⟉    U+27C8, U+27C9   REVERSE SOLIDUS PRECEDING SUBSET,  SUPERSET
535                           PRECEDING SOLIDUS
536  ⟦  ⟧    U+27E6, U+27E7   MATHEMATICAL LEFT/RIGHT WHITE SQUARE BRACKET
537  ⟨  ⟩    U+27E8, U+27E9   MATHEMATICAL LEFT/RIGHT ANGLE BRACKET
538  ⟪  ⟫    U+27EA, U+27EB   MATHEMATICAL LEFT/RIGHT DOUBLE ANGLE BRACKET
539  ⟬  ⟭    U+27EC, U+27ED   MATHEMATICAL LEFT/RIGHT WHITE TORTOISE SHELL
540                           BRACKET
541  ⟮  ⟯    U+27EE, U+27EF   MATHEMATICAL LEFT/RIGHT FLATTENED PARENTHESIS
542  ⦃  ⦄    U+2983, U+2984   LEFT/RIGHT WHITE CURLY BRACKET
543  ⦅  ⦆    U+2985, U+2986   LEFT/RIGHT WHITE PARENTHESIS
544  ⦇  ⦈    U+2987, U+2988   Z NOTATION LEFT/RIGHT IMAGE BRACKET
545  ⦉  ⦊    U+2989, U+298A   Z NOTATION LEFT/RIGHT BINDING BRACKET
546  ⦋  ⦌    U+298B, U+298C   LEFT/RIGHT SQUARE BRACKET WITH UNDERBAR
547  ⦍  ⦐    U+298D, U+2990   LEFT/RIGHT SQUARE BRACKET WITH TICK IN TOP
548                           CORNER
549  ⦏  ⦎    U+298F, U+298E   LEFT/RIGHT SQUARE BRACKET WITH TICK IN BOTTOM
550                           CORNER
551  ⦑  ⦒    U+2991, U+2992   LEFT/RIGHT ANGLE BRACKET WITH DOT
552  ⦓  ⦔    U+2993, U+2994   LEFT/RIGHT ARC LESS-THAN/GREATER-THAN BRACKET
553  ⦕  ⦖    U+2995, U+2996   DOUBLE LEFT/RIGHT ARC GREATER-THAN/LESS-THAN
554                           BRACKET
555  ⦗  ⦘    U+2997, U+2998   LEFT/RIGHT BLACK TORTOISE SHELL BRACKET
556  ⧀  ⧁    U+29C0, U+29C1   CIRCLED LESS-THAN/GREATER-THAN
557  ⧘  ⧙    U+29D8, U+29D9   LEFT/RIGHT WIGGLY FENCE
558  ⧚  ⧛    U+29DA, U+29DB   LEFT/RIGHT DOUBLE WIGGLY FENCE
559  ⧼  ⧽    U+29FC, U+29FD   LEFT/RIGHT-POINTING CURVED ANGLE BRACKET
560  ⩹  ⩺    U+2A79, U+2A7A   LESS-THAN/GREATER-THAN WITH CIRCLE INSIDE
561  ⩻  ⩼    U+2A7B, U+2A7C   LESS-THAN/GREATER-THAN WITH QUESTION MARK ABOVE
562  ⩽  ⩾    U+2A7D, U+2A7E   LESS-THAN/GREATER-THAN OR SLANTED EQUAL TO
563  ⩿  ⪀    U+2A7F, U+2A80   LESS-THAN/GREATER-THAN OR SLANTED EQUAL TO WITH
564                           DOT INSIDE
565  ⪁  ⪂    U+2A81, U+2A82   LESS-THAN/GREATER-THAN OR SLANTED EQUAL TO WITH
566                           DOT ABOVE
567  ⪃  ⪄    U+2A83, U+2A84   LESS-THAN/GREATER-THAN OR SLANTED EQUAL TO WITH
568                           DOT ABOVE RIGHT/LEFT
569  ⪅  ⪆    U+2A85, U+2A86   LESS-THAN/GREATER-THAN OR APPROXIMATE
570  ⪇  ⪈    U+2A87, U+2A88   LESS-THAN/GREATER-THAN AND SINGLE-LINE NOT
571                           EQUAL TO
572  ⪉  ⪊    U+2A89, U+2A8A   LESS-THAN/GREATER-THAN AND NOT APPROXIMATE
573  ⪍  ⪎    U+2A8D, U+2A8E   LESS-THAN/GREATER-THAN ABOVE SIMILAR OR EQUAL
574  ⪕  ⪖    U+2A95, U+2A96   SLANTED EQUAL TO OR LESS-THAN/GREATER-THAN
575  ⪗  ⪘    U+2A97, U+2A98   SLANTED EQUAL TO OR LESS-THAN/GREATER-THAN WITH
576                           DOT INSIDE
577  ⪙  ⪚    U+2A99, U+2A9A   DOUBLE-LINE EQUAL TO OR LESS-THAN/GREATER-THAN
578  ⪛  ⪜    U+2A9B, U+2A9C   DOUBLE-LINE SLANTED EQUAL TO OR LESS-THAN/
579                           GREATER-THAN
580  ⪝  ⪞    U+2A9D, U+2A9E   SIMILAR OR LESS-THAN/GREATER-THAN
581  ⪟  ⪠    U+2A9F, U+2AA0   SIMILAR ABOVE LESS-THAN/GREATER-THAN ABOVE
582                           EQUALS SIGN
583  ⪡  ⪢    U+2AA1, U+2AA2   DOUBLE NESTED LESS-THAN/GREATER-THAN
584  ⪦  ⪧    U+2AA6, U+2AA7   LESS-THAN/GREATER-THAN CLOSED BY CURVE
585  ⪨  ⪩    U+2AA8, U+2AA9   LESS-THAN/GREATER-THAN CLOSED BY CURVE ABOVE
586                           SLANTED EQUAL
587  ⪪  ⪫    U+2AAA, U+2AAB   SMALLER THAN/LARGER THAN
588  ⪬  ⪭    U+2AAC, U+2AAD   SMALLER THAN/LARGER THAN OR EQUAL TO
589  ⪯  ⪰    U+2AAF, U+2AB0   PRECEDES/SUCCEEDS ABOVE SINGLE-LINE EQUALS SIGN
590  ⪱  ⪲    U+2AB1, U+2AB2   PRECEDES/SUCCEEDS ABOVE SINGLE-LINE NOT EQUAL TO
591  ⪳  ⪴    U+2AB3, U+2AB4   PRECEDES/SUCCEEDS ABOVE EQUALS SIGN
592  ⪵  ⪶    U+2AB5, U+2AB6   PRECEDES/SUCCEEDS ABOVE NOT EQUAL TO
593  ⪷  ⪸    U+2AB7, U+2AB8   PRECEDES/SUCCEEDS ABOVE ALMOST EQUAL TO
594  ⪹  ⪺    U+2AB9, U+2ABA   PRECEDES/SUCCEEDS ABOVE NOT ALMOST EQUAL TO
595  ⪻  ⪼    U+2ABB, U+2ABC   DOUBLE PRECEDES/SUCCEEDS
596  ⪽  ⪾    U+2ABD, U+2ABE   SUBSET/SUPERSET WITH DOT
597  ⪿  ⫀    U+2ABF, U+2AC0   SUBSET/SUPERSET WITH PLUS SIGN BELOW
598  ⫁  ⫂    U+2AC1, U+2AC2   SUBSET/SUPERSET WITH MULTIPLICATION SIGN BELOW
599  ⫃  ⫄    U+2AC3, U+2AC4   SUBSET/SUPERSET OF OR EQUAL TO WITH DOT ABOVE
600  ⫅  ⫆    U+2AC5, U+2AC6   SUBSET/SUPERSET OF ABOVE EQUALS SIGN
601  ⫇  ⫈    U+2AC7, U+2AC8   SUBSET/SUPERSET OF ABOVE TILDE OPERATOR
602  ⫉  ⫊    U+2AC9, U+2ACA   SUBSET/SUPERSET OF ABOVE ALMOST EQUAL TO
603  ⫋  ⫌    U+2ACB, U+2ACC   SUBSET/SUPERSET OF ABOVE NOT EQUAL TO
604  ⫏  ⫐    U+2ACF, U+2AD0   CLOSED SUBSET/SUPERSET
605  ⫑  ⫒    U+2AD1, U+2AD2   CLOSED SUBSET/SUPERSET OR EQUAL TO
606  ⫕  ⫖    U+2AD5, U+2AD6   SUBSET/SUPERSET ABOVE SUBSET/SUPERSET
607  ⫷  ⫸    U+2AF7, U+2AF8   TRIPLE NESTED LESS-THAN/GREATER-THAN
608  ⫹  ⫺    U+2AF9, U+2AFA   DOUBLE-LINE SLANTED LESS-THAN/GREATER-THAN OR
609                           EQUAL TO
610  ⸂  ⸃    U+2E02, U+2E03   LEFT/RIGHT SUBSTITUTION BRACKET
611  ⸃  ⸂    U+2E03, U+2E02   RIGHT/LEFT SUBSTITUTION BRACKET
612  ⸄  ⸅    U+2E04, U+2E05   LEFT/RIGHT DOTTED SUBSTITUTION BRACKET
613  ⸅  ⸄    U+2E05, U+2E04   RIGHT/LEFT DOTTED SUBSTITUTION BRACKET
614  ⸉  ⸊    U+2E09, U+2E0A   LEFT/RIGHT TRANSPOSITION BRACKET
615  ⸊  ⸉    U+2E0A, U+2E09   RIGHT/LEFT TRANSPOSITION BRACKET
616  ⸌  ⸍    U+2E0C, U+2E0D   LEFT/RIGHT RAISED OMISSION BRACKET
617  ⸍  ⸌    U+2E0D, U+2E0C   RIGHT/LEFT RAISED OMISSION BRACKET
618  ⸑  ⸐    U+2E11, U+2E10   REVERSED FORKED PARAGRAPHOS,  FORKED PARAGRAPHOS
619  ⸜  ⸝    U+2E1C, U+2E1D   LEFT/RIGHT LOW PARAPHRASE BRACKET
620  ⸝  ⸜    U+2E1D, U+2E1C   RIGHT/LEFT LOW PARAPHRASE BRACKET
621  ⸠  ⸡    U+2E20, U+2E21   LEFT/RIGHT VERTICAL BAR WITH QUILL
622  ⸡  ⸠    U+2E21, U+2E20   RIGHT/LEFT VERTICAL BAR WITH QUILL
623  ⸢  ⸣    U+2E22, U+2E23   TOP LEFT/RIGHT HALF BRACKET
624  ⸤  ⸥    U+2E24, U+2E25   BOTTOM LEFT/RIGHT HALF BRACKET
625  ⸦  ⸧    U+2E26, U+2E27   LEFT/RIGHT SIDEWAYS U BRACKET
626  ⸨  ⸩    U+2E28, U+2E29   LEFT/RIGHT DOUBLE PARENTHESIS
627  ⸶  ⸷    U+2E36, U+2E37   DAGGER WITH LEFT/RIGHT GUARD
628  ⹂  „    U+2E42, U+201E   DOUBLE LOW-REVERSED-9 QUOTATION MARK,  DOUBLE
629                           LOW-9 QUOTATION MARK
630  ⹕  ⹖    U+2E55, U+2E56   LEFT/RIGHT SQUARE BRACKET WITH STROKE
631  ⹗  ⹘    U+2E57, U+2E58   LEFT/RIGHT SQUARE BRACKET WITH DOUBLE STROKE
632  ⹙  ⹚    U+2E59, U+2E5A   TOP HALF LEFT/RIGHT PARENTHESIS
633  ⹛  ⹜    U+2E5B, U+2E5C   BOTTOM HALF LEFT/RIGHT PARENTHESIS
634  〈 〉   U+3008, U+3009   LEFT/RIGHT ANGLE BRACKET
635  《 》   U+300A, U+300B   LEFT/RIGHT DOUBLE ANGLE BRACKET
636  「 」   U+300C, U+300D   LEFT/RIGHT CORNER BRACKET
637  『 』   U+300E, U+300F   LEFT/RIGHT WHITE CORNER BRACKET
638  【 】   U+3010, U+3011   LEFT/RIGHT BLACK LENTICULAR BRACKET
639  〔 〕   U+3014, U+3015   LEFT/RIGHT TORTOISE SHELL BRACKET
640  〖 〗   U+3016, U+3017   LEFT/RIGHT WHITE LENTICULAR BRACKET
641  〘 〙   U+3018, U+3019   LEFT/RIGHT WHITE TORTOISE SHELL BRACKET
642  〚 〛   U+301A, U+301B   LEFT/RIGHT WHITE SQUARE BRACKET
643  〝 〞   U+301D, U+301E   REVERSED DOUBLE PRIME QUOTATION MARK,  DOUBLE
644                           PRIME QUOTATION MARK
645  ꧁  ꧂    U+A9C1, U+A9C2   JAVANESE LEFT/RIGHT RERENGGAN
646  ﴾  ﴿    U+FD3E, U+FD3F   ORNATE LEFT/RIGHT PARENTHESIS
647  ﹙ ﹚   U+FE59, U+FE5A   SMALL LEFT/RIGHT PARENTHESIS
648  ﹛ ﹜   U+FE5B, U+FE5C   SMALL LEFT/RIGHT CURLY BRACKET
649  ﹝ ﹞   U+FE5D, U+FE5E   SMALL LEFT/RIGHT TORTOISE SHELL BRACKET
650  ﹤ ﹥   U+FE64, U+FE65   SMALL LESS-THAN/GREATER-THAN SIGN
651  ( )   U+FF08, U+FF09   FULLWIDTH LEFT/RIGHT PARENTHESIS
652  < >   U+FF1C, U+FF1E   FULLWIDTH LESS-THAN/GREATER-THAN SIGN
653  [ ]   U+FF3B, U+FF3D   FULLWIDTH LEFT/RIGHT SQUARE BRACKET
654  { }   U+FF5B, U+FF5D   FULLWIDTH LEFT/RIGHT CURLY BRACKET
655  ⦅ ⦆   U+FF5F, U+FF60   FULLWIDTH LEFT/RIGHT WHITE PARENTHESIS
656  「  」    U+FF62, U+FF63   HALFWIDTH LEFT/RIGHT CORNER BRACKET
657
658 =head1 FEATURE BUNDLES
659
660 It's possible to load multiple features together, using
661 a I<feature bundle>.  The name of a feature bundle is prefixed with
662 a colon, to distinguish it from an actual feature.
663
664   use feature ":5.10";
665
666 The following feature bundles are available:
667
668   bundle    features included
669   --------- -----------------
670   :default  indirect multidimensional
671             bareword_filehandles
672
673   :5.10     bareword_filehandles indirect
674             multidimensional say state switch
675
676   :5.12     bareword_filehandles indirect
677             multidimensional say state switch
678             unicode_strings
679
680   :5.14     bareword_filehandles indirect
681             multidimensional say state switch
682             unicode_strings
683
684   :5.16     bareword_filehandles current_sub evalbytes
685             fc indirect multidimensional say state
686             switch unicode_eval unicode_strings
687
688   :5.18     bareword_filehandles current_sub evalbytes
689             fc indirect multidimensional say state
690             switch unicode_eval unicode_strings
691
692   :5.20     bareword_filehandles current_sub evalbytes
693             fc indirect multidimensional say state
694             switch unicode_eval unicode_strings
695
696   :5.22     bareword_filehandles current_sub evalbytes
697             fc indirect multidimensional say state
698             switch unicode_eval unicode_strings
699
700   :5.24     bareword_filehandles current_sub evalbytes
701             fc indirect multidimensional postderef_qq
702             say state switch unicode_eval
703             unicode_strings
704
705   :5.26     bareword_filehandles current_sub evalbytes
706             fc indirect multidimensional postderef_qq
707             say state switch unicode_eval
708             unicode_strings
709
710   :5.28     bareword_filehandles bitwise current_sub
711             evalbytes fc indirect multidimensional
712             postderef_qq say state switch unicode_eval
713             unicode_strings
714
715   :5.30     bareword_filehandles bitwise current_sub
716             evalbytes fc indirect multidimensional
717             postderef_qq say state switch unicode_eval
718             unicode_strings
719
720   :5.32     bareword_filehandles bitwise current_sub
721             evalbytes fc indirect multidimensional
722             postderef_qq say state switch unicode_eval
723             unicode_strings
724
725   :5.34     bareword_filehandles bitwise current_sub
726             evalbytes fc indirect multidimensional
727             postderef_qq say state switch unicode_eval
728             unicode_strings
729
730   :5.36     bitwise current_sub evalbytes fc isa
731             postderef_qq say signatures state
732             unicode_eval unicode_strings
733
734 The C<:default> bundle represents the feature set that is enabled before
735 any C<use feature> or C<no feature> declaration.
736
737 Specifying sub-versions such as the C<0> in C<5.14.0> in feature bundles has
738 no effect.  Feature bundles are guaranteed to be the same for all sub-versions.
739
740   use feature ":5.14.0";    # same as ":5.14"
741   use feature ":5.14.1";    # same as ":5.14"
742
743 =head1 IMPLICIT LOADING
744
745 Instead of loading feature bundles by name, it is easier to let Perl do
746 implicit loading of a feature bundle for you.
747
748 There are two ways to load the C<feature> pragma implicitly:
749
750 =over 4
751
752 =item *
753
754 By using the C<-E> switch on the Perl command-line instead of C<-e>.
755 That will enable the feature bundle for that version of Perl in the
756 main compilation unit (that is, the one-liner that follows C<-E>).
757
758 =item *
759
760 By explicitly requiring a minimum Perl version number for your program, with
761 the C<use VERSION> construct.  That is,
762
763     use v5.10.0;
764
765 will do an implicit
766
767     no feature ':all';
768     use feature ':5.10';
769
770 and so on.  Note how the trailing sub-version
771 is automatically stripped from the
772 version.
773
774 But to avoid portability warnings (see L<perlfunc/use>), you may prefer:
775
776     use 5.010;
777
778 with the same effect.
779
780 If the required version is older than Perl 5.10, the ":default" feature
781 bundle is automatically loaded instead.
782
783 Unlike C<use feature ":5.12">, saying C<use v5.12> (or any higher version)
784 also does the equivalent of C<use strict>; see L<perlfunc/use> for details.
785
786 =back
787
788 =head1 CHECKING FEATURES
789
790 C<feature> provides some simple APIs to check which features are enabled.
791
792 These functions cannot be imported and must be called by their fully
793 qualified names.  If you don't otherwise need to set a feature you will
794 need to ensure C<feature> is loaded with:
795
796   use feature ();
797
798 =over
799
800 =item feature_enabled($feature)
801
802 =item feature_enabled($feature, $depth)
803
804   package MyStandardEnforcer;
805   use feature ();
806   use Carp "croak";
807   sub import {
808     croak "disable indirect!" if feature::feature_enabled("indirect");
809   }
810
811 Test whether a named feature is enabled at a given level in the call
812 stack, returning a true value if it is.  C<$depth> defaults to 1,
813 which checks the scope that called the scope calling
814 feature::feature_enabled().
815
816 croaks for an unknown feature name.
817
818 =item features_enabled()
819
820 =item features_enabled($depth)
821
822   package ReportEnabledFeatures;
823   use feature "say";
824   sub import {
825     say STDERR join " ", feature::features_enabled();
826   }
827
828 Returns a list of the features enabled at a given level in the call
829 stack.  C<$depth> defaults to 1, which checks the scope that called
830 the scope calling feature::features_enabled().
831
832 =item feature_bundle()
833
834 =item feature_bundle($depth)
835
836 Returns the feature bundle, if any, selected at a given level in the
837 call stack.  C<$depth> defaults to 1, which checks the scope that called
838 the scope calling feature::feature_bundle().
839
840 Returns an undefined value if no feature bundle is selected in the
841 scope.
842
843 The bundle name returned will be for the earliest bundle matching the
844 selected bundle, so:
845
846   use feature ();
847   use v5.12;
848   BEGIN { print feature::feature_bundle(0); }
849
850 will print C<5.11>.
851
852 This returns internal state, at this point C<use v5.12;> sets the
853 feature bundle, but C< use feature ":5.12"; > does not set the feature
854 bundle.  This may change in a future release of perl.
855
856 =back
857
858 =cut
859
860 sub import {
861     shift;
862
863     if (!@_) {
864         croak("No features specified");
865     }
866
867     __common(1, @_);
868 }
869
870 sub unimport {
871     shift;
872
873     # A bare C<no feature> should reset to the default bundle
874     if (!@_) {
875         $^H &= ~($hint_uni8bit|$hint_mask);
876         return;
877     }
878
879     __common(0, @_);
880 }
881
882
883 sub __common {
884     my $import = shift;
885     my $bundle_number = $^H & $hint_mask;
886     my $features = $bundle_number != $hint_mask
887       && $feature_bundle{$hint_bundles[$bundle_number >> $hint_shift]};
888     if ($features) {
889         # Features are enabled implicitly via bundle hints.
890         # Delete any keys that may be left over from last time.
891         delete @^H{ values(%feature) };
892         $^H |= $hint_mask;
893         for (@$features) {
894             $^H{$feature{$_}} = 1;
895             $^H |= $hint_uni8bit if $_ eq 'unicode_strings';
896         }
897     }
898     while (@_) {
899         my $name = shift;
900         if (substr($name, 0, 1) eq ":") {
901             my $v = substr($name, 1);
902             if (!exists $feature_bundle{$v}) {
903                 $v =~ s/^([0-9]+)\.([0-9]+).[0-9]+$/$1.$2/;
904                 if (!exists $feature_bundle{$v}) {
905                     unknown_feature_bundle(substr($name, 1));
906                 }
907             }
908             unshift @_, @{$feature_bundle{$v}};
909             next;
910         }
911         if (!exists $feature{$name}) {
912             if (exists $noops{$name}) {
913                 next;
914             }
915             if (!$import && exists $removed{$name}) {
916                 next;
917             }
918             unknown_feature($name);
919         }
920         if ($import) {
921             $^H{$feature{$name}} = 1;
922             $^H |= $hint_uni8bit if $name eq 'unicode_strings';
923         } else {
924             delete $^H{$feature{$name}};
925             $^H &= ~ $hint_uni8bit if $name eq 'unicode_strings';
926         }
927     }
928 }
929
930 sub unknown_feature {
931     my $feature = shift;
932     croak(sprintf('Feature "%s" is not supported by Perl %vd',
933             $feature, $^V));
934 }
935
936 sub unknown_feature_bundle {
937     my $feature = shift;
938     croak(sprintf('Feature bundle "%s" is not supported by Perl %vd',
939             $feature, $^V));
940 }
941
942 sub croak {
943     require Carp;
944     Carp::croak(@_);
945 }
946
947 sub features_enabled {
948     my ($depth) = @_;
949
950     $depth //= 1;
951     my @frame = caller($depth+1)
952       or return;
953     my ($hints, $hinthash) = @frame[8, 10];
954
955     my $bundle_number = $hints & $hint_mask;
956     if ($bundle_number != $hint_mask) {
957         return $feature_bundle{$hint_bundles[$bundle_number >> $hint_shift]}->@*;
958     }
959     else {
960         my @features;
961         for my $feature (sort keys %feature) {
962             if ($hinthash->{$feature{$feature}}) {
963                 push @features, $feature;
964             }
965         }
966         return @features;
967     }
968 }
969
970 sub feature_enabled {
971     my ($feature, $depth) = @_;
972
973     $depth //= 1;
974     my @frame = caller($depth+1)
975       or return;
976     my ($hints, $hinthash) = @frame[8, 10];
977
978     my $hint_feature = $feature{$feature}
979       or croak "Unknown feature $feature";
980     my $bundle_number = $hints & $hint_mask;
981     if ($bundle_number != $hint_mask) {
982         my $bundle = $hint_bundles[$bundle_number >> $hint_shift];
983         for my $bundle_feature ($feature_bundle{$bundle}->@*) {
984             return 1 if $bundle_feature eq $feature;
985         }
986         return 0;
987     }
988     else {
989         return $hinthash->{$hint_feature} // 0;
990     }
991 }
992
993 sub feature_bundle {
994     my $depth = shift;
995
996     $depth //= 1;
997     my @frame = caller($depth+1)
998       or return;
999     my $bundle_number = $frame[8] & $hint_mask;
1000     if ($bundle_number != $hint_mask) {
1001         return $hint_bundles[$bundle_number >> $hint_shift];
1002     }
1003     else {
1004         return undef;
1005     }
1006 }
1007
1008 1;
1009
1010 # ex: set ro: