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
More B bugs: svref_2object #7696
Comments
From at@altlinux.ruCreated by at@altlinux.ruHello, Recently I reported this bug on perl5-porters mailing list. Brief description: consequent svref_2object calls produce wrong http://www.nntp.perl.org/group/perl.perl5.porters/96593 -- Perl Info
|
From smcc@OCF.Berkeley.EDU
AT> Hello, AT> Recently I reported this bug on perl5-porters mailing list. AT> Brief description: consequent svref_2object calls produce wrong AT> http://www.nntp.perl.org/group/perl.perl5.porters/96593 I think your diagnosis is correct. The B module in general, and However, I think the best solution is "don't do that, then". B is The appended documentation patch attempts to explain that one -- Stephen Index: B.pm--- B.pm (revision 18175) +The returned object will only be valid as long as the underlying OPs Returns the SV object corresponding to the C variable C<amagic_generation>. Note that all access is read-only. You cannot modify the internals by =head2 SV-RELATED CLASSES |
The RT System itself - Status changed from 'new' to 'open' |
From at@altlinux.ruOn Tue, Dec 28, 2004 at 04:01:49PM -0800, Stephen McCamant wrote:
Okay, thanks a lot for this clarification. Unfortunately I don't quite [...] You see, without referencing $version to global $perlbug32967 variable, So I feel like there's still a subtle problem: I can't understand why To examine the real code, you may want to take a look at
|
From @ysthOn Tue, Dec 28, 2004 at 04:01:49PM -0800, Stephen McCamant wrote:
So you probably also shouldn't try to do things like: [http://perlmonks.org/index.pl?node_id=379395] ? :) |
From smcc@mit.edu
AT> Brief description: consequent svref_2object calls produce wrong AT> http://www.nntp.perl.org/group/perl.perl5.porters/96593 SMcC> I think your diagnosis is correct. The B module in general, and AT> Okay, thanks a lot for this clarification. Unfortunately I don't quite AT> [...] [snip] AT> To examine the real code, you may want to take a look at I think I can explain more easily what's going on in your simple AT> my $v1 = 0.17; The first Dump shows that its argument is a reference to a B::NV What I think may be confusing about this example is that get_sv Thus all three calls to get_sv return B::SV objects referring to the If you change the code to pass the variable by reference, i.e. sub get_sv { you'll see that $v1 stays an NV. To sharpen what I was saying above, I don't think your bug comes from On to how you might fix your real bug (note I've added a bit more AT> sub extract_version { I think the real problem with sv_version is that its logic is wrong: For a single invocation that shows this problem, try: my $x = 3; print sv_version(svref_2object(\$x)), "\n"; The first three lines make $x a PVMG with no string value or V magic I'd suggest testing in the following order: if (SV has "V" magic) { Hope this helps, -- Stephen |
From @rgsStephen McCamant wrote:
My favourite ones :)
Thanks, applied as 23845 to bleadperl. |
@smpeters - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#32967 (status was 'resolved')
Searchable as RT32967$
The text was updated successfully, but these errors were encountered: