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
__PACKAGE__ symbol has wrong value after eval or require #7608
Comments
From @mjdominusCreated by @mjdominusperl -le 'package D; eval q{print __PACKAGE__}' This prints "main", but it should print "D". Similarly, perl -le 'package D; require "printpack.pl"' does the same, when "printpack.pl" contains print __PACKAGE__; This was reported to me by Benjamin Smith, bsmith@cpan.org. Note that variables and subroutines defined inside the "eval" or Perl Info
|
From @rgsMark-Jason Dominus (via RT) wrote:
This very simple patch appears to fix it : --- toke.c (revision 4047) End. Now, this might be only an indication of a deeper problem with PL_curstname, |
The RT System itself - Status changed from 'new' to 'open' |
From @steve-m-hayRafael Garcia-Suarez wrote:
It also seems to fix the similar bug reported a while back by Schwern http://www.xray.mpe.mpg.de/mailing-lists/perl5-porters/2004-04/msg00433.html - Steve Radan Computational Ltd. The information contained in this message and any files transmitted with it are confidential and intended for the addressee(s) only. If you have received this message in error or there are any problems, please notify the sender immediately. The unauthorized use, disclosure, copying or alteration of this message is strictly forbidden. Note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Radan Computational Ltd. The recipient(s) of this message should check it and any attached files for viruses: Radan Computational will accept no liability for any damage caused by any virus transmitted by this email. |
From @rgsRafael Garcia-Suarez wrote:
Yes, the following patch seems to be more logical, but it breaks lots of --- pp_ctl.c (revision 4033) if (CopSTASH_ne(PL_curcop, PL_curstash)) { So I'm going to commit the first one, with tests. -- |
From @rgsFixed by : Fix for bug: [perl #32562] __PACKAGE__ symbol has wrong value |
@rgs - Status changed from 'open' to 'resolved' |
From @smpeters
The follow patch for a test case works with change #23528 but fails with Inline Patch--- t/op/my_stash.t.orig Tue Nov 23 08:06:42 2004
+++ t/op/my_stash.t Tue Nov 23 08:06:55 2004
@@ -31,3 +31,5 @@
ok $@;
# print $@ if $@;
}
+
+eval q{ok __PACKAGE__ eq 'Foo'}; |
From @rgsSteve Peters via RT wrote:
Thanks, I've already commited a test like this one, in t/comp/package.t.
|
From nick@ing-simmons.netRafael Garcia-Suarez <rgarciasuarez@mandrakesoft.com> writes:
It may _change_ it, but is it a fix?
|
From @rgsNick Ing-Simmons wrote:
A new scope, yes, but a new namespace ? Given that my patch changed the behaviour of require'ing a file which -- |
From nick@ing-simmons.netRafael Garcia-Suarez <rgarciasuarez@mandrakesoft.com> writes:
Does it affect 'do' as well?
It surprised me once, not that I was using it, but that I suspect that behaviour was useful for perl4-ish .pl files |
Migrated from rt.perl.org#32562 (status was 'resolved')
Searchable as RT32562$
The text was updated successfully, but these errors were encountered: