Lines Matching defs:feature
3 # This file is built by regen/feature.pl.
6 package feature;
9 our %feature = (
89 # - think about versioned features (use feature switch => 2)
95 feature - Perl pragma to enable new features
99 use feature qw(fc say);
101 # Without the "use feature" above, this code would not be able to find
108 use feature ':5.36';
111 # implicitly loads :5.36 feature bundle
119 constructs, can be enabled by C<use feature 'foo'>, and will be parsed
120 only when the appropriate feature pragma is in scope. (Nevertheless, the
127 effect. C<use feature qw(foo)> will only make the feature "foo" available
131 use feature 'say';
136 =head2 C<no feature>
138 Features can also be turned off by using C<no feature "foo">. This too
141 use feature 'say';
144 no feature 'say';
149 C<no feature> with no features specified will reset to the default group. To
150 disable I<all> features (an unusual request!) use C<no feature ':all'>.
154 Read L</"FEATURE BUNDLES"> for the feature cheat sheet summary.
156 =head2 The 'say' feature
158 C<use feature 'say'> tells the compiler to enable the Raku-inspired
163 This feature is available starting with Perl 5.10.
165 =head2 The 'state' feature
167 C<use feature 'state'> tells the compiler to enable C<state>
172 This feature is available starting with Perl 5.10.
174 =head2 The 'switch' feature
176 B<WARNING>: This feature is still experimental and the implementation may
178 warn when you use the feature, unless you have explicitly disabled the warning:
182 C<use feature 'switch'> tells the compiler to enable the Raku
187 This feature is available starting with Perl 5.10.
192 =head2 The 'unicode_strings' feature
194 C<use feature 'unicode_strings'> tells the compiler to use Unicode rules
201 C<no feature 'unicode_strings'> tells the compiler to use the traditional
207 C<use feature 'unicode_strings'> subpragma is B<strongly> recommended.
209 This feature is available starting with Perl 5.12; was almost fully
225 them, so the feature can be enabled and disabled. Details are at
226 L<perlfunc/Under the "unicode_eval" feature>.
230 S<C<use feature 'evalbytes'>> nor a S<C<use v5.16>> (or higher) declaration in
234 =head2 The 'current_sub' feature
239 This feature is available starting with Perl 5.16.
241 =head2 The 'array_base' feature
243 This feature supported the legacy C<$[> variable. See L<perlvar/$[>.
247 This feature is available under this name starting with Perl 5.16. In
251 =head2 The 'fc' feature
253 C<use feature 'fc'> tells the compiler to enable the C<fc> function,
258 This feature is available from Perl 5.16 onwards.
260 =head2 The 'lexical_subs' feature
262 In Perl versions prior to 5.26, this feature enabled
266 This feature is available from Perl 5.18 onwards. From Perl 5.18 to 5.24,
272 As of Perl 5.26, use of this feature no longer triggers a warning, though
276 regardless of what feature declarations are in scope.
280 The 'postderef_qq' feature extends the applicability of L<postfix
289 This feature is available from Perl 5.20 onwards. In Perl 5.20 and 5.22, it
295 As of Perl 5.24, use of this feature no longer triggers a warning, though
299 The 'postderef' feature was used in Perl 5.20 and Perl 5.22 to enable
302 same way as the 'postderef_qq' feature did. As of Perl 5.24, this syntax is
304 regardless of what feature declarations are in scope.
306 =head2 The 'signatures' feature
319 This feature is available from Perl 5.20 onwards. From Perl 5.20 to 5.34,
325 As of Perl 5.36, use of this feature no longer triggers a warning, though the
327 with code that disables it). This feature is now considered stable, and is
330 =head2 The 'refaliasing' feature
332 B<WARNING>: This feature is still experimental and the implementation may
334 warn when you use the feature, unless you have explicitly disabled the warning:
350 This feature is available from Perl 5.22 onwards.
352 =head2 The 'bitwise' feature
361 This feature is available from Perl 5.22 onwards. Starting in Perl 5.28,
362 C<use v5.28> will enable the feature. Before 5.28, it was still
366 =head2 The 'declared_refs' feature
368 B<WARNING>: This feature is still experimental and the implementation may
370 warn when you use the feature, unless you have explicitly disabled the warning:
376 conjunction with the "refaliasing" feature. See L<perlref/Declaring a
379 This feature is available from Perl 5.26 onwards.
381 =head2 The 'isa' feature
387 This feature is available from Perl 5.32 onwards. From Perl 5.32 to 5.34,
393 As of Perl 5.36, use of this feature no longer triggers a warning (though the
395 code that disables it). This feature is now considered stable, and is enabled
398 =head2 The 'indirect' feature
400 This feature allows the use of L<indirect object
405 This feature is available under this name from Perl 5.32 onwards. In
410 =head2 The 'multidimensional' feature
412 This feature enables multidimensional array emulation, a perl 4 (or
413 earlier) feature that was used to emulate multidimensional arrays with
418 When this feature is disabled the syntax that is normally replaced
421 This feature is available under this name from Perl 5.34 onwards. In
427 =head2 The 'bareword_filehandles' feature
429 This feature enables bareword filehandles for builtin functions
437 This feature is available under this name from Perl 5.34 onwards. In
443 =head2 The 'try' feature
445 B<WARNING>: This feature is still partly experimental, and the implementation
448 This feature enables the C<try> and C<catch> syntax, which allows exception
452 This feature is available starting in Perl 5.34. Before Perl 5.40 it was
458 As of Perl 5.40, use of this feature without a C<finally> block no longer
464 =head2 The 'defer' feature
466 B<WARNING>: This feature is still experimental and the implementation may
468 warn when you use the feature, unless you have explicitly disabled the warning:
472 This feature enables the C<defer> block syntax, which allows a block of code
476 This feature is available starting in Perl 5.36.
478 =head2 The 'extra_paired_delimiters' feature
480 B<WARNING>: This feature is still experimental and the implementation may
482 warn when you use the feature, unless you have explicitly disabled the warning:
486 This feature enables the use of more paired string delimiters than the
488 this feature is on, for example, you can say S<C<qrE<171>patE<187>>>.
494 This feature is available starting in Perl 5.36.
499 =head2 The 'module_true' feature
501 This feature removes the need to return a true value at the end of a module
503 failures, but reaching the end of the module when this feature is in effect
507 =head2 The 'class' feature
509 B<WARNING>: This feature is still experimental and the implementation may
511 warn when you use the feature, unless you have explicitly disabled the warning:
515 This feature enables the C<class> block syntax and other associated keywords
521 a I<feature bundle>. The name of a feature bundle is prefixed with
522 a colon, to distinguish it from an actual feature.
524 use feature ":5.10";
526 The following feature bundles are available:
602 The C<:default> bundle represents the feature set that is enabled before
603 any C<use feature> or C<no feature> declaration.
605 Specifying sub-versions such as the C<0> in C<5.14.0> in feature bundles has
608 use feature ":5.14.0"; # same as ":5.14"
609 use feature ":5.14.1"; # same as ":5.14"
613 use feature ":all";
617 no feature ":all";
626 Instead of loading feature bundles by name, it is easier to let Perl do
627 implicit loading of a feature bundle for you.
629 There are two ways to load the C<feature> pragma implicitly:
636 That will enable the feature bundle for that version of Perl in the
648 no feature ':all';
649 use feature ':5.36';
661 If the required version is older than Perl 5.10, the ":default" feature
664 Unlike C<use feature ":5.12">, saying C<use v5.12> (or any higher version)
671 C<feature> provides some simple APIs to check which features are enabled.
674 qualified names. If you don't otherwise need to set a feature you will
675 need to ensure C<feature> is loaded with:
677 use feature ();
681 =item feature_enabled($feature)
683 =item feature_enabled($feature, $depth)
686 use feature ();
689 croak "disable indirect!" if feature::feature_enabled("indirect");
692 Test whether a named feature is enabled at a given level in the call
695 feature::feature_enabled().
697 croaks for an unknown feature name.
704 use feature "say";
706 say STDERR join " ", feature::features_enabled();
711 the scope calling feature::features_enabled().
717 Returns the feature bundle, if any, selected at a given level in the
719 the scope calling feature::feature_bundle().
721 Returns an undefined value if no feature bundle is selected in the
727 use feature ();
729 BEGIN { print feature::feature_bundle(0); }
734 feature bundle, but C< use feature ":5.12"; > does not set the feature
754 # A bare C<no feature> should reset to the default bundle
772 delete @^H{ values(%feature) };
775 $^H{$feature{$_}} = 1;
792 if (!exists $feature{$name}) {
802 $^H{$feature{$name}} = 1;
805 delete $^H{$feature{$name}};
812 my $feature = shift;
814 $feature, $^V));
818 my $feature = shift;
820 $feature, $^V));
842 for my $feature (sort keys %feature) {
843 if ($hinthash->{$feature{$feature}}) {
844 push @features, $feature;
852 my ($feature, $depth) = @_;
859 my $hint_feature = $feature{$feature}
860 or croak "Unknown feature $feature";
865 return 1 if $bundle_feature eq $feature;