| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
warning_like() provides a subset of the functionality of the routine of the
same name in Test::Warn. Remove the definition of must_warn() in t/re/subst.t,
which had been copied from t/re/ReTest.pl from when ReTest.pl and test.pl
clashed.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit 3e462cdc2087ddf90984010fabd80c30db92bfa0 provided a fix
for the s/non-utf8/is-utf8/ case by upgrading TARG to UTF8 after the
match, but before the substitution. It used sv_utf8_upgrade() rather than
sv_utf8_upgrade_nomg(), so for example, with a tied variable, FETCH would
get called again, and all the char* pointers such as s would be left
dangling. If the length of the string was unchanged, the code wouldn't
notice this.
Fix by using the _nomg() variant, and by checking whether the string
has been reallocated
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
$ perl -le '$_="CCCGGG"; s!.!@a{print("[$&]"),/./}!g'
[C]
[C]
[C]
[C]
[C]
[C]
What’s happening is that the s/// does not reset PL_curpm for each
iteration, because it doesn’t usually have to.
The RHS’s scoping takes care of it most of the time. This happens with
the /e modifier and with @{...}.
In this example, though, we have a subscript, not a block. This sub-
script is in the same scope as the s/// itself.
The assumption that the substitution operator will never have to reset
PL_curpm itself appears to be incorrect. This fixes it.
|
| |
|
|
|
|
| |
Signed-off-by: David Golden <dagolden@cpan.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This changes s/// so that it doesn't act destructively on its target.
Instead it returns the result of the substitution (or the original string if
there was no match).
In addition this patch:
* Adds a new warning when s///r happens in void context.
* Adds a error when you try to use s///r with !~
* Makes it so constant strings can be bound to s///r with =~
* Adds documentation.
* Adds some tests.
* Updates various debug code so it knows about the /r flag.
* Adds some new 'r' words to B::Deparse.
|
|
|
|
|
|
|
|
|
|
| |
When the replacement is in utf8, there was failure to upgrade the result
when the source and the pattern weren't in utf8. This simply checks
that when there is a match that will lead to the replacement being done.
It then does the upgrade. If this led to changes in the source, we redo
the match because pointers to saved buffers could have changed. There
may be other cases where we don't need to redo the match, but I don't
know the code well-enough to easily figure it out.
|
|
|
|
|
| |
[N.B. I converted package name separators from q{'} to q{::} in
the test files as suggested by demerphq. -- dagolden]
|
|
|