warn when you enable the feature, unless you have explicitly disabled the
warning:
- no warnings "experimental:lexical_subs";
+ no warnings "experimental::lexical_subs";
This enables declaration of subroutines via C<my sub foo>, C<state sub foo>
and C<our sub foo> syntax. See L<perlsub/Lexical Subroutines> for details.
$^H |= $hint_uni8bit if $name eq 'unicode_strings';
if ($experimental{$name}) {
require warnings;
- warnings::warnif("experimental:$name",
+ warnings::warnif("experimental::$name",
"The $name feature is experimental");
}
} else {
A number of functions are provided to assist module authors.
-In all the descriptions below, $category can also be a warnings category
-and ID separated by a colon, such as "experimental:lexical_subs". See
-L<perllexwarn/Individual Warning IDs>.
-
=over 4
=item use warnings::register
# Warnings Categories added in Perl 5.017
'experimental' => 102,
- 'experimental:lexical_subs'=> 104,
+ 'experimental::lexical_subs'=> 104,
);
our %Bits = (
'exec' => "\x00\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [7]
'exiting' => "\x40\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [3]
'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x01", # [51,52]
- 'experimental:lexical_subs'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", # [52]
+ 'experimental::lexical_subs'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", # [52]
'glob' => "\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [4]
'illegalproto' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x00\x00", # [47]
'imprecision' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x10\x00\x00", # [46]
'exec' => "\x00\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [7]
'exiting' => "\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [3]
'experimental' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x02", # [51,52]
- 'experimental:lexical_subs'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", # [52]
+ 'experimental::lexical_subs'=> "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02", # [52]
'glob' => "\x00\x02\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", # [4]
'illegalproto' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x80\x00\x00", # [47]
'imprecision' => "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00", # [46]
(F) To use lexical subs, you must first enable them:
- no warnings 'experimental:lexical_subs';
+ no warnings 'experimental::lexical_subs';
use feature 'lexical_subs';
my sub foo { ... }
of using an experimental feature which may change or be removed in a
future Perl version:
- no warnings "experimental:lexical_subs";
+ no warnings "experimental::lexical_subs";
use feature "lexical_subs";
=item The %s function is unimplemented
|
+- exiting
|
- +- experimental
+ +- experimental --+
+ | |
+ | +- experimental::lexical_subs
|
+- glob
|
sub-category of the "syntax" category. It is now a top-level category
in its own right.
-=head2 Individual Warning IDs
-
-The "experimental" warnings category, added in Perl 5.18,
-contains IDs for individual warnings, so that each warning can
-be turned on or off. Currently there is only one such warning,
-labelled "experimental:lexical_subs". You enable and disable
-it like this:
-
- use warnings "experimental:lexical_subs";
- no warnings "experimental:lexical_subs";
-
-The plan is to extend this convention to all warnings in a future release.
-
=head2 Fatal Warnings
X<warning, fatal>
Lexical subroutines are only available under the C<use feature
'lexical_subs'> pragma, which produces a warning unless the
-"experimental:lexical_subs" warning is disabled.
+"experimental::lexical_subs" warnings category is disabled.
Beginning with Perl 5.18, you can declare a private subroutine with C<my>
or C<state>. As with state variables, the C<state> keyword is only
These subroutines are only visible within the block in which they are
declared, and only after that declaration:
- no warnings "experimental:lexical_subs";
+ no warnings "experimental::lexical_subs";
use feature 'lexical_subs';
foo(); # calls the package/global subroutine
So, in general, "state" subroutines are faster. But "my" subs are
necessary if you want to create closures:
- no warnings "experimental:lexical_subs";
+ no warnings "experimental::lexical_subs";
use feature 'lexical_subs';
sub whatever {
The two main uses for this are to switch back to using the package sub
inside an inner scope:
- no warnings "experimental:lexical_subs";
+ no warnings "experimental::lexical_subs";
use feature 'lexical_subs';
sub foo { ... }
package MySneakyModule;
- no warnings "experimental:lexical_subs";
+ no warnings "experimental::lexical_subs";
use feature 'lexical_subs';
our sub do_something { ... }
warn when you enable the feature, unless you have explicitly disabled the
warning:
- no warnings "experimental:lexical_subs";
+ no warnings "experimental::lexical_subs";
This enables declaration of subroutines via C<my sub foo>, C<state sub foo>
and C<our sub foo> syntax. See L<perlsub/Lexical Subroutines> for details.
$^H |= $hint_uni8bit if $name eq 'unicode_strings';
if ($experimental{$name}) {
require warnings;
- warnings::warnif("experimental:$name",
+ warnings::warnif("experimental::$name",
"The $name feature is experimental");
}
} else {
'threads' => [ 5.008, DEFAULT_OFF],
'imprecision' => [ 5.011, DEFAULT_OFF],
'experimental' => [ 5.017, {
- 'experimental:lexical_subs' =>
+ 'experimental::lexical_subs' =>
[ 5.017, DEFAULT_ON ],
}],
}
my ($ver, $rest) = @{ $v } ;
- if (ref $rest && $k ne 'experimental')
+ if (ref $rest)
{
my $bar = @keys ? "|" : " ";
print " -" . "-" x ($max - length $k ) . "+\n" ;
A number of functions are provided to assist module authors.
-In all the descriptions below, $category can also be a warnings category
-and ID separated by a colon, such as "experimental:lexical_subs". See
-L<perllexwarn/Individual Warning IDs>.
-
=over 4
=item use warnings::register
# -------------------- our -------------------- #
-no warnings "experimental:lexical_subs";
+no warnings "experimental::lexical_subs";
use feature 'lexical_subs';
{
our sub foo { 42 }
/* Warnings Categories added in Perl 5.017 */
#define WARN_EXPERIMENTAL 51
-#define WARN_EXPERIMENTAL_LEXICAL_SUBS 52
+#define WARN_EXPERIMENTAL__LEXICAL_SUBS 52
#define WARNsize 14
#define WARN_ALLstring "\125\125\125\125\125\125\125\125\125\125\125\125\125\125"