-
Notifications
You must be signed in to change notification settings - Fork 560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
local $1 is not an error - bug or feature? [and then make %+ and %- consistent] #10598
Comments
From @nwc10Created by @nwc10%+ and %- are implemented as tied hashes, using XS code in universal.c STORE attempts to cope with localisation. For example: XS(XS_Tie_Hash_NamedCapture_STORE) if (items != 3) rx = PL_curpm ? PM_GETRE(PL_curpm) : NULL; if (!rx || !SvROK(ST(0))) { SP -= items; flags = (U32)SvUV(SvRV(MUTABLE_SV(ST(0)))); However, this doesn't work: $ ./perl -Ilib -le 'local $-{pie}; warn "Get here"' Note that the first one gets past the warn statement, then fails in scope The second one is particularly spectacular, with double error messages.
Does it even make sense to support localising %+ and %-? Nicholas Clark Perl Info
|
From @nwc10On Wed Sep 01 07:06:55 2010, nicholas wrote:
All tests still pass with this change: Inline Patchdiff --git a/universal.c b/universal.c
index 6593501..8d627c2 100644
--- a/universal.c
+++ b/universal.c
@@ -1388,10 +1388,7 @@ XS(XS_Tie_Hash_NamedCapture_STORE)
rx = PL_curpm ? PM_GETRE(PL_curpm) : NULL;
if (!rx || !SvROK(ST(0))) {
- if (!PL_localizing)
- Perl_croak_no_modify(aTHX);
- else
- XSRETURN_UNDEF;
+ Perl_croak_no_modify(aTHX);
}
SP -= items;
It strikes me that the return values from STORE, DELETE and CLEAR are Nicholas Clark |
@nwc10 - Status changed from 'new' to 'open' |
From @avarOn Wed, Sep 1, 2010 at 14:33, Nicholas Clark via RT
Probably yes.
I didn't really know what I was doing back when I wrote that, I was So your way is probably better. |
From @cpansproutOn Thu Sep 02 04:16:13 2010, avarab@gmail.com wrote:
If it is applied, do we need tests, too? The reason I ask is that I’m |
From @nwc10On Sun, Sep 26, 2010 at 06:38:11PM -0700, Father Chrysostomos via RT wrote:
I don't think that it can be tested, as I believe the code to be unreachable. Nicholas Clark commit f84ff04 XS_Tie_Hash_NamedCapture_STORE should always croak on invalid parameters. Inline Patchdiff --git a/universal.c b/universal.c
index e3e91cf..5442f87 100644
--- a/universal.c
+++ b/universal.c
@@ -1307,10 +1307,7 @@ XS(XS_Tie_Hash_NamedCapture_STORE)
rx = PL_curpm ? PM_GETRE(PL_curpm) : NULL;
if (!rx || !SvROK(ST(0))) {
- if (!PL_localizing)
- Perl_croak_no_modify(aTHX);
- else
- XSRETURN_UNDEF;
+ Perl_croak_no_modify(aTHX);
}
SP -= items; |
This appears to have been in perl since v5.13.10 |
Migrated from rt.perl.org#77610 (status was 'open')
Searchable as RT77610$
The text was updated successfully, but these errors were encountered: