Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deprecate the ':all' feature bundle #22817

Open
wants to merge 1 commit into
base: blead
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion lib/feature.pm

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions pod/perldelta.pod
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,12 @@ L<XXX> has been upgraded from version A.xx to B.yy.

XXX If there was something important to note about this change, include that here.

=item *

L<feature> has been upgraded from version 1.89 to 1.93.

The C<:all> feature bundle now warns, suggesting you should not use it.

=back

=head2 Removed Modules and Pragmata
Expand Down
9 changes: 8 additions & 1 deletion regen/feature.pl
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ sub longest {

__END__
package feature;
our $VERSION = '1.92';
our $VERSION = '1.93';

FEATURES

Expand Down Expand Up @@ -1175,6 +1175,8 @@ sub __common {
my $name = shift;
if (substr($name, 0, 1) eq ":") {
my $v = substr($name, 1);
carp('Feature bundle ":all" is deprecated and should not be used')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use

warnings::warnif(deprecated => "...");

so it's conditional on the category

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used carp because the rest of the module used croak for errors. Is there the equivalent for carp? Or should I just not bother?

if $v eq 'all';
if (!exists $feature_bundle{$v}) {
$v =~ s/^([0-9]+)\.([0-9]+).[0-9]+$/$1.$2/;
if (!exists $feature_bundle{$v}) {
Expand Down Expand Up @@ -1215,6 +1217,11 @@ sub unknown_feature_bundle {
$feature, $^V));
}

sub carp {
require Carp;
Carp::carp(@_);
}

Comment on lines +1220 to +1224
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be removed by using warnings::warnif

sub croak {
require Carp;
Carp::croak(@_);
Expand Down
1 change: 0 additions & 1 deletion t/comp/require.t
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,6 @@ BEGIN {
my @params = (
'use v5.37',
'use feature ":5.38"',
'use feature ":all"',
'use feature "module_true"',
'no feature "module_true"',
'',
Expand Down
1 change: 1 addition & 0 deletions t/lib/feature/bundle
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ Assigning non-zero to $[ is no longer possible at - line 5.
no feature ':all'; # turns array_base (and everything else) off
$[ = 1;
EXPECT
Feature bundle ":all" is deprecated and should not be used at - line 2.
Assigning non-zero to $[ is no longer possible at - line 3.
########
# NAME $^H accidentally enabling all features
Expand Down
6 changes: 3 additions & 3 deletions t/op/lexsub.t
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ like runperl(
# This used to fail an assertion, but only as a standalone script
is runperl(switches => ['-lXMfeature=:all'],
prog => 'state sub x {}; undef &x; print defined &x',
stderr => 1), "\n", 'undefining state sub';
stderr => 1), "Feature bundle \":all\" is deprecated and should not be used at -e line 0.\n\n", 'undefining state sub';
{
state sub x { is +(caller 0)[3], 'x', 'state sub name in caller' }
x
Expand Down Expand Up @@ -475,7 +475,7 @@ is runperl(switches => ['-lXMfeature=:all'],
x()
}
x()',
stderr => 1), "42\n",
stderr => 1), "Feature bundle \":all\" is deprecated and should not be used at -e line 0.\n42\n",
'closure behaviour of state sub in predeclared package sub';

# -------------------- my -------------------- #
Expand Down Expand Up @@ -830,7 +830,7 @@ pass "pad taking ownership once more of packagified my-sub";
# This used to fail an assertion, but only as a standalone script
is runperl(switches => ['-lXMfeature=:all'],
prog => 'my sub x {}; undef &x; print defined &x',
stderr => 1), "\n", 'undefining my sub';
stderr => 1), "Feature bundle \":all\" is deprecated and should not be used at -e line 0.\n\n", 'undefining my sub';
{
my sub x { is +(caller 0)[3], 'x', 'my sub name in caller' }
x
Expand Down
Loading