it may skip items, or visit items more than once. Consider using
C<keys()> instead of C<each()>.
+=item Use of the empty pattern inside of a regex code block is forbidden
+
+(F) You tried to use the empty pattern inside of a regex code block,
+for instance C</(?{ s!!! })/>. Currently for implementation reasons
+this is forbidden. Generally you can rewrite code that uses the empty
+pattern with the appropriate use of C<qr//>.
+
=item Use of := for an empty attribute list is not allowed
(F) The construction C<my $x := 42> used to parse as equivalent to
#if !defined(USE_ITHREADS)
/* can't change the optree at runtime either */
/* PMf_KEEP is handled differently under threads to avoid these problems */
- if (!RX_PRELEN(PM_GETRE(pm)) && PL_curpm)
+ /* Handle empty pattern */
+ if (!RX_PRELEN(PM_GETRE(pm)) && PL_curpm) {
+ if (PL_curpm == PL_reg_curpm)
+ croak("Use of the empty pattern inside of "
+ "a regex code block is forbidden");
pm = PL_curpm;
+ }
if (pm->op_pmflags & PMf_KEEP) {
pm->op_private &= ~OPpRUNTIME; /* no point compiling again */
cLOGOP->op_first->op_next = PL_op->op_next;
/* empty pattern special-cased to use last successful pattern if
possible, except for qr// */
- if (!ReANY(rx)->mother_re && !RX_PRELEN(rx)
- && PL_curpm) {
+ if (!ReANY(rx)->mother_re && !RX_PRELEN(rx) && PL_curpm) {
+ if (PL_curpm == PL_reg_curpm)
+ croak("Use of the empty pattern inside of "
+ "a regex code block is forbidden");
pm = PL_curpm;
rx = PM_GETRE(pm);
}
position, once with zero-length,
second time with non-zero. */
- if (!RX_PRELEN(rx) && PL_curpm
- && !ReANY(rx)->mother_re) {
+ /* handle the empty pattern */
+ if (!RX_PRELEN(rx) && PL_curpm && !ReANY(rx)->mother_re) {
+ if (PL_curpm == PL_reg_curpm)
+ croak("Use of the empty pattern inside of "
+ "a regex code block is forbidden");
pm = PL_curpm;
rx = PM_GETRE(pm);
}