-
Notifications
You must be signed in to change notification settings - Fork 569
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
blead: local $_ doesn't mix with @_ => Modification of a read-only value attempted #6765
Comments
From stas@stason.orgThis is a bug report for perl from stas@stason.org, This script: foo("bbb"); generates: Modification of a read-only value attempted at test line 7 under blead@21198. It works fine with 5.8.1@21184 and lower. This problem breaks the mod_perl 1.0 build. Flags: Site configuration information for perl v5.9.0: Configured by stas at Fri Sep 12 14:42:18 PDT 2003. Summary of my perl5 (revision 5.0 version 9 subversion 0 patch 21198) Locally applied patches: @INC for perl v5.9.0: Environment for perl v5.9.0: PATH=/usr//bin:/bin:/usr/bin:.:/usr/local/bin:/usr/X11R6/bin:/usr/games:/home/stas/bin:/home/stas/bin:/usr/local/bin:/usr/X11R6/bin:/usr/java/j2re1.4.0/bin/ __________________________________________________________________ |
From @andk
Blame 20479. Note that replacing line 6 with C< s/x/y/ > works. ----Program---- ----Output of .../prIMRVC/perl-5.8.0@20478/bin/perl---- ----EOF ($?='65280')---- -- |
From stas@stason.orgAndreas J Koenig wrote:
Thanks Andreas. So is it a feature or a bug? Change 20479 by rgs@rgs-home on 2003/08/04 20:26:17 Fix bug #23141 : localization of readonly magic scalars it doesn't happen in maint perl, Rafael?
-- __________________________________________________________________ |
From @rgsStas Bekman wrote:
See <http://bugs6.perl.org/rt2/Ticket/Display.html?id=23141>.
This kind of change is not suitable for a maint branch. Jarkko didn't
Interesting. This substitution sets 'g' magic on $_. And localisation Then, at the 2nd iteration of the loop, the localisation fails, as the The obvious workaround is to iterate over a copy of @_. This foo() However, s/// adding magic to its argument is probably suboptimal
|
From stas@stason.orgRafael Garcia-Suarez wrote:
But it's not a bug in the code I've posted, it's a bug in perl, no? Am I
Sorry, I lost you in the guts :( __________________________________________________________________ |
From @rgarciaStas Bekman wrote:
Let's say it's a suboptimal interference with the guts to the program. The s/// adds some magic to "bbb". My patch introduced the fact that $ perl5.8.0 -le '1=~/(.)/;for($1){local$_=2;print}' This lead to obscure behaviour when using dark magic, like in your case.
No, it's the modification of the localised $_ that fails here. Not the HTH. |
From stas@stason.orgRafael Garcia-Suarez wrote:
In other words, what you saying is that your patch alerts about the problem __________________________________________________________________ |
From @rgarciaStas Bekman wrote:
Yes, it will hide it. I've been looking at your problem -- I understand why it happens, |
From stas@stason.orgRafael Garcia-Suarez (via RT) wrote:
ok, so I just need to wait a bit ;) Thanks Rafael! __________________________________________________________________ |
From @andk
> Rafael Garcia-Suarez (via RT) wrote:
> ok, so I just need to wait a bit ;) Thanks Rafael! I'd say, switch to using lexicals instead of $_ and sleep better! Why use strict; ? And while we are at it, why not give the inner $arg a different name I tend to avoid $_ in large programs or modules or any code the gets -- |
From stas@stason.orgAndreas J Koenig wrote:
the real code is in the Apache/ExtUtils.pm's import function of mod_perl 1.0, __________________________________________________________________ |
@rgs - Status changed from 'new' to 'resolved' |
Migrated from rt.perl.org#23803 (status was 'resolved')
Searchable as RT23803$
The text was updated successfully, but these errors were encountered: