package feature;
our $VERSION = '1.13';
# (feature name) => (internal name, used in %^H)
my %feature = (
switch => 'feature_switch',
say => "feature_say",
state => "feature_state",
);
# NB. the latest bundle must be loaded by the -E switch (see toke.c)
my %feature_bundle = (
"5.10" => [qw(switch say state)],
### "5.11" => [qw(switch say state)],
);
# special case
$feature_bundle{"5.9.5"} = $feature_bundle{"5.10"};
# TODO:
# - think about versioned features (use feature switch => 2)
=head1 NAME
feature - Perl pragma to enable new syntactic features
=head1 SYNOPSIS
use feature qw(switch say);
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 ':5.10'; # loads all features available in perl 5.10
=head1 DESCRIPTION
It is usually impossible to add new syntax to Perl without breaking
some existing programs. This pragma provides a way to minimize that
risk. New syntactic constructs can be enabled by C