| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "experimental 3perl" |
| 58 |
.TH experimental 3perl 2025-11-16 "perl v5.40.1" "Perl Programmers Reference Guide" |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
experimental \- Experimental features made easy |
| 65 |
.SH VERSION |
| 66 |
.IX Header "VERSION" |
| 67 |
version 0.032 |
| 68 |
.SH SYNOPSIS |
| 69 |
.IX Header "SYNOPSIS" |
| 70 |
.Vb 2 |
| 71 |
\& use experimental \*(Aqlexical_subs\*(Aq, \*(Aqsignatures\*(Aq; |
| 72 |
\& my sub plus_one($value) { $value + 1 } |
| 73 |
.Ve |
| 74 |
.SH DESCRIPTION |
| 75 |
.IX Header "DESCRIPTION" |
| 76 |
This pragma provides an easy and convenient way to enable or disable |
| 77 |
experimental features. |
| 78 |
.PP |
| 79 |
Every version of perl has some number of features present but considered |
| 80 |
"experimental." For much of the life of Perl 5, this was only a designation |
| 81 |
found in the documentation. Starting in Perl v5.10.0, and more aggressively in |
| 82 |
v5.18.0, experimental features were placed behind pragmata used to enable the |
| 83 |
feature and disable associated warnings. |
| 84 |
.PP |
| 85 |
The \f(CW\*(C`experimental\*(C'\fR pragma exists to combine the required incantations into a |
| 86 |
single interface stable across releases of perl. For every experimental |
| 87 |
feature, this should enable the feature and silence warnings for the enclosing |
| 88 |
lexical scope: |
| 89 |
.PP |
| 90 |
.Vb 1 |
| 91 |
\& use experimental \*(Aqfeature\-name\*(Aq; |
| 92 |
.Ve |
| 93 |
.PP |
| 94 |
To disable the feature and, if applicable, re-enable any warnings, use: |
| 95 |
.PP |
| 96 |
.Vb 1 |
| 97 |
\& no experimental \*(Aqfeature\-name\*(Aq; |
| 98 |
.Ve |
| 99 |
.PP |
| 100 |
The supported features, documented further below, are: |
| 101 |
.IP \(bu 4 |
| 102 |
\&\f(CW\*(C`args_array_with_signatures\*(C'\fR \- allow \f(CW@_\fR to be used in signatured subs. |
| 103 |
.Sp |
| 104 |
This is supported on perl 5.20.0 and above, but is likely to be removed in the future. |
| 105 |
.IP \(bu 4 |
| 106 |
\&\f(CW\*(C`array_base\*(C'\fR \- allow the use of \f(CW$[\fR to change the starting index of \f(CW@array\fR. |
| 107 |
.Sp |
| 108 |
This was removed in perl 5.30.0. |
| 109 |
.IP \(bu 4 |
| 110 |
\&\f(CW\*(C`autoderef\*(C'\fR \- allow push, each, keys, and other built-ins on references. |
| 111 |
.Sp |
| 112 |
This was added in perl 5.14.0 and removed in perl 5.24.0. |
| 113 |
.IP \(bu 4 |
| 114 |
\&\f(CW\*(C`bitwise\*(C'\fR \- allow the new stringwise bit operators |
| 115 |
.Sp |
| 116 |
This was added in perl 5.22.0. |
| 117 |
.IP \(bu 4 |
| 118 |
\&\f(CW\*(C`builtin\*(C'\fR \- allow the use of the functions in the builtin:: namespace |
| 119 |
.Sp |
| 120 |
This was added in perl 5.36.0 |
| 121 |
.IP \(bu 4 |
| 122 |
\&\f(CW\*(C`const_attr\*(C'\fR \- allow the :const attribute on subs |
| 123 |
.Sp |
| 124 |
This was added in perl 5.22.0. |
| 125 |
.IP \(bu 4 |
| 126 |
\&\f(CW\*(C`declared_refs\*(C'\fR \- enables aliasing via assignment to references |
| 127 |
.Sp |
| 128 |
This was added in perl 5.26.0. |
| 129 |
.IP \(bu 4 |
| 130 |
\&\f(CW\*(C`defer\*(C'\fR \- enables the use of defer blocks |
| 131 |
.Sp |
| 132 |
This was added in perl 5.36.0 |
| 133 |
.IP \(bu 4 |
| 134 |
\&\f(CW\*(C`extra_paired_delimiters\*(C'\fR \- enables the use of more paired string delimiters than the |
| 135 |
traditional four, \f(CW\*(C`<\ \ >\*(C'\fR, \f(CW\*(C`(\ )\*(C'\fR, \f(CW\*(C`{\ }\*(C'\fR, and \f(CW\*(C`[\ ]\*(C'\fR. |
| 136 |
.Sp |
| 137 |
This was added in perl 5.36. |
| 138 |
.IP \(bu 4 |
| 139 |
\&\f(CW\*(C`for_list\*(C'\fR \- allows iterating over multiple values at a time with \f(CW\*(C`for\*(C'\fR |
| 140 |
.Sp |
| 141 |
This was added in perl 5.36.0 |
| 142 |
.IP \(bu 4 |
| 143 |
\&\f(CW\*(C`isa\*(C'\fR \- allow the use of the \f(CW\*(C`isa\*(C'\fR infix operator |
| 144 |
.Sp |
| 145 |
This was added in perl 5.32.0. |
| 146 |
.IP \(bu 4 |
| 147 |
\&\f(CW\*(C`lexical_topic\*(C'\fR \- allow the use of lexical \f(CW$_\fR via \f(CW\*(C`my $_\*(C'\fR. |
| 148 |
.Sp |
| 149 |
This was added in perl 5.10.0 and removed in perl 5.24.0. |
| 150 |
.IP \(bu 4 |
| 151 |
\&\f(CW\*(C`lexical_subs\*(C'\fR \- allow the use of lexical subroutines. |
| 152 |
.Sp |
| 153 |
This was added in 5.18.0, and became non-experimental (and always enabled) in 5.26.0. |
| 154 |
.IP \(bu 4 |
| 155 |
\&\f(CW\*(C`postderef\*(C'\fR \- allow the use of postfix dereferencing expressions |
| 156 |
.Sp |
| 157 |
This was added in perl 5.20.0, and became non-experimental (and always enabled) in 5.24.0. |
| 158 |
.IP \(bu 4 |
| 159 |
\&\f(CW\*(C`postderef_qq\*(C'\fR \- allow the use of postfix dereferencing expressions inside interpolating strings |
| 160 |
.Sp |
| 161 |
This was added in perl 5.20.0, and became non-experimental (and always enabled) in 5.24.0. |
| 162 |
.IP \(bu 4 |
| 163 |
\&\f(CW\*(C`re_strict\*(C'\fR \- enables strict mode in regular expressions |
| 164 |
.Sp |
| 165 |
This was added in perl 5.22.0. |
| 166 |
.IP \(bu 4 |
| 167 |
\&\f(CW\*(C`refaliasing\*(C'\fR \- allow aliasing via \f(CW\*(C`\e$x = \e$y\*(C'\fR |
| 168 |
.Sp |
| 169 |
This was added in perl 5.22.0. |
| 170 |
.IP \(bu 4 |
| 171 |
\&\f(CW\*(C`regex_sets\*(C'\fR \- allow extended bracketed character classes in regexps |
| 172 |
.Sp |
| 173 |
This was added in perl 5.18.0. |
| 174 |
.IP \(bu 4 |
| 175 |
\&\f(CW\*(C`signatures\*(C'\fR \- allow subroutine signatures (for named arguments) |
| 176 |
.Sp |
| 177 |
This was added in perl 5.20.0. |
| 178 |
.IP \(bu 4 |
| 179 |
\&\f(CW\*(C`smartmatch\*(C'\fR \- allow the use of \f(CW\*(C`~~\*(C'\fR |
| 180 |
.Sp |
| 181 |
This was added in perl 5.10.0, but it should be noted there are significant |
| 182 |
incompatibilities between 5.10.0 and 5.10.1. |
| 183 |
.Sp |
| 184 |
The feature is going to be deprecated in perl 5.38.0, and removed in 5.42.0. |
| 185 |
.IP \(bu 4 |
| 186 |
\&\f(CW\*(C`switch\*(C'\fR \- allow the use of \f(CW\*(C`~~\*(C'\fR, given, and when |
| 187 |
.Sp |
| 188 |
This was added in perl 5.10.0. |
| 189 |
.Sp |
| 190 |
The feature is going to be deprecated in perl 5.38.0, and removed in 5.42.0. |
| 191 |
.IP \(bu 4 |
| 192 |
\&\f(CW\*(C`try\*(C'\fR \- allow the use of \f(CW\*(C`try\*(C'\fR and \f(CW\*(C`catch\*(C'\fR |
| 193 |
.Sp |
| 194 |
This was added in perl 5.34.0 |
| 195 |
.IP \(bu 4 |
| 196 |
\&\f(CW\*(C`win32_perlio\*(C'\fR \- allows the use of the :win32 IO layer. |
| 197 |
.Sp |
| 198 |
This was added on perl 5.22.0. |
| 199 |
.SS "Ordering matters" |
| 200 |
.IX Subsection "Ordering matters" |
| 201 |
Using this pragma to 'enable an experimental feature' is another way of saying |
| 202 |
that this pragma will disable the warnings which would result from using that |
| 203 |
feature. Therefore, the order in which pragmas are applied is important. In |
| 204 |
particular, you probably want to enable experimental features \fIafter\fR you |
| 205 |
enable warnings: |
| 206 |
.PP |
| 207 |
.Vb 2 |
| 208 |
\& use warnings; |
| 209 |
\& use experimental \*(Aqsmartmatch\*(Aq; |
| 210 |
.Ve |
| 211 |
.PP |
| 212 |
You also need to take care with modules that enable warnings for you. A common |
| 213 |
example being Moose. In this example, warnings for the 'smartmatch' feature are |
| 214 |
first turned on by the warnings pragma, off by the experimental pragma and back |
| 215 |
on again by the Moose module (fix is to switch the last two lines): |
| 216 |
.PP |
| 217 |
.Vb 3 |
| 218 |
\& use warnings; |
| 219 |
\& use experimental \*(Aqsmartmatch\*(Aq; |
| 220 |
\& use Moose; |
| 221 |
.Ve |
| 222 |
.SS Disclaimer |
| 223 |
.IX Subsection "Disclaimer" |
| 224 |
Because of the nature of the features it enables, forward compatibility can not |
| 225 |
be guaranteed in any way. |
| 226 |
.SH "SEE ALSO" |
| 227 |
.IX Header "SEE ALSO" |
| 228 |
perlexperiment contains more information about experimental features. |
| 229 |
.SH AUTHOR |
| 230 |
.IX Header "AUTHOR" |
| 231 |
Leon Timmermans <[email protected]> |
| 232 |
.SH "COPYRIGHT AND LICENSE" |
| 233 |
.IX Header "COPYRIGHT AND LICENSE" |
| 234 |
This software is copyright (c) 2013 by Leon Timmermans. |
| 235 |
.PP |
| 236 |
This is free software; you can redistribute it and/or modify it under |
| 237 |
the same terms as the Perl 5 programming language system itself. |