Skip to content

Commit

Permalink
feature.pl: stop using "switch" as a demo feature!
Browse files Browse the repository at this point in the history
It is experimental, it would cause warnings, and frankly, I would
like to just inch toward its disappearance.
  • Loading branch information
rjbs committed Apr 4, 2021
1 parent 8fa44a4 commit 3dcf39c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
17 changes: 8 additions & 9 deletions lib/feature.pm
Expand Up @@ -85,16 +85,15 @@ 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;
use feature ':5.10'; # loads all features available in perl 5.10
use feature ':5.10'; # sets features to match the :5.10 bundle, which
# may turn off or on multiple features (see below)
use v5.10; # implicitly loads :5.10 feature bundle
Expand Down
17 changes: 8 additions & 9 deletions regen/feature.pl
Expand Up @@ -491,16 +491,15 @@ =head1 NAME
=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;
use feature ':5.10'; # loads all features available in perl 5.10
use feature ':5.10'; # sets features to match the :5.10 bundle, which
# may turn off or on multiple features (see below)
use v5.10; # implicitly loads :5.10 feature bundle
Expand Down

0 comments on commit 3dcf39c

Please sign in to comment.