diff options
author | chromatic <chromatic@wgz.org> | 2022-10-27 11:24:58 +0200 |
---|---|---|
committer | Yves Orton <demerphq@gmail.com> | 2022-11-01 09:46:16 +0100 |
commit | 1102a6f006f2bb626d2c7f1c5b7d360c28518129 (patch) | |
tree | eb90ea178d14524d853018b788c2c0bc02021d22 /lib | |
parent | 73d66f354cd4df0324b11e46af48f66bd5c1dd15 (diff) | |
download | perl-1102a6f006f2bb626d2c7f1c5b7d360c28518129.tar.gz |
Enable `use feature 'module_true'`
Per RFC 18, whenever `use feature 'module_true';` is enabled in a scope,
any file required with `require` has an implicit return value of true
and will not trigger the "did not return a true value" error condition.
This includes logic to use the OPf_SPECIAL flag for OP_RETURN listops to
indicate that the module_true feature is in effect when it executes.
This flag plays no role unless the OP_RETURN tail calls the pp_leaveeval
logic, so it doesn't affect normal sub returns.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/feature.pm | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/feature.pm b/lib/feature.pm index 523fe48d97..ae6d486028 100644 --- a/lib/feature.pm +++ b/lib/feature.pm @@ -4,8 +4,7 @@ # Any changes made here will be lost! package feature; - -our $VERSION = '1.76'; +our $VERSION = '1.77'; our %feature = ( fc => 'feature_fc', @@ -20,6 +19,7 @@ our %feature = ( evalbytes => 'feature_evalbytes', signatures => 'feature_signatures', current_sub => 'feature___SUB__', + module_true => 'feature_module_true', refaliasing => 'feature_refaliasing', postderef_qq => 'feature_postderef_qq', unicode_eval => 'feature_unieval', @@ -37,8 +37,8 @@ our %feature_bundle = ( "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)], "5.35" => [qw(bareword_filehandles bitwise current_sub evalbytes fc isa postderef_qq say signatures state unicode_eval unicode_strings)], - "5.37" => [qw(bitwise current_sub evalbytes fc isa postderef_qq say signatures state unicode_eval unicode_strings)], - "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)], + "5.37" => [qw(bitwise current_sub evalbytes fc isa module_true postderef_qq say signatures state unicode_eval unicode_strings)], + "all" => [qw(bareword_filehandles bitwise current_sub declared_refs defer evalbytes extra_paired_delimiters fc indirect isa module_true multidimensional postderef_qq refaliasing say signatures state switch try unicode_eval unicode_strings)], "default" => [qw(bareword_filehandles indirect multidimensional)], ); @@ -867,6 +867,14 @@ The complete list of accepted paired delimiters as of Unicode 14.0 is: 🢫 🢪 U+1F8AB, U+1F8AA RIGHT/LEFTWARDS FRONT-TILTED SHADOWED WHITE ARROW +=head2 The 'module_true' feature + +This feature removes the need to return a true value at the end of a module +loaded with C<require> or C<use>. Any errors during compilation will cause +failures, but reaching the end of the module when this feature is in effect +will prevent C<perl> from throwing an exception that the module "did not return +a true value". + =head1 FEATURE BUNDLES It's possible to load multiple features together, using @@ -944,8 +952,8 @@ The following feature bundles are available: state unicode_eval unicode_strings :5.38 bitwise current_sub evalbytes fc isa - postderef_qq say signatures state - unicode_eval unicode_strings + module_true postderef_qq say signatures + state 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. |