G
gb345
Some code that used to work fine with perl 5.8.8 now generates a
warning when I run it with perl 5.10.0. The error is caused by a
recursive regex that is supposed to match a balanced expression.
This regex is defined using qr//, and is assigned to the variable
$pex, and mentions this variable in its definition.
The warning message is:
Variable "$pex" will not stay shared at (re_eval 5) line 2.
Variable "$pex" will not stay shared at (re_eval 6) line 2.
Here's the beast:
my $pex;
$pex = qr/
\{
(?:
(?:
"
( (?> (?:[^"\\]|\\[^"])* ) (?> \\" (?:[^"\\]|\\[^"])* )* )
"
|
(?!\{) ( [^",]* ) (?<!\})
|
(??{ $pex })
)
(?:
,
(?:
"
( (?> (?:[^"\\]|\\[^"])* ) (?> \\" (?:[^"\\]|\\[^"])* )* )
"
|
(?!\{) ( [^",]* ) (?<!\})
|
(??{ $pex })
)
)*
)?
\}
/x;
I want to fix whatever it is that the warning is warning about
(rather than simply turn off the warning), but it's not clear to
me exactly what the problem is (especially since this code has been
performing flawlessly up to now).
Any clarifications of what the error message is actually saying,
or suggestions to fix the problem would be much appreciated.
Many thanks in advance!
Gabe
warning when I run it with perl 5.10.0. The error is caused by a
recursive regex that is supposed to match a balanced expression.
This regex is defined using qr//, and is assigned to the variable
$pex, and mentions this variable in its definition.
The warning message is:
Variable "$pex" will not stay shared at (re_eval 5) line 2.
Variable "$pex" will not stay shared at (re_eval 6) line 2.
Here's the beast:
my $pex;
$pex = qr/
\{
(?:
(?:
"
( (?> (?:[^"\\]|\\[^"])* ) (?> \\" (?:[^"\\]|\\[^"])* )* )
"
|
(?!\{) ( [^",]* ) (?<!\})
|
(??{ $pex })
)
(?:
,
(?:
"
( (?> (?:[^"\\]|\\[^"])* ) (?> \\" (?:[^"\\]|\\[^"])* )* )
"
|
(?!\{) ( [^",]* ) (?<!\})
|
(??{ $pex })
)
)*
)?
\}
/x;
I want to fix whatever it is that the warning is warning about
(rather than simply turn off the warning), but it's not clear to
me exactly what the problem is (especially since this code has been
performing flawlessly up to now).
Any clarifications of what the error message is actually saying,
or suggestions to fix the problem would be much appreciated.
Many thanks in advance!
Gabe