Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Sub-Uplevel CPAN distribution.

Report information
The Basics
Id: 55241
Status: resolved
Priority: 0/
Queue: Sub-Uplevel

People
Owner: Nobody in particular
Requestors: david [...] cantrell.org.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Sup::Uplevel's caller() misbehaves when within multiple levels of uplevel()ing
Date: Thu, 4 Mar 2010 22:55:07 +0000
To: bug-Sub-Uplevel [...] rt.cpan.org, dagolden [...] cpan.org
From: David Cantrell <david [...] cantrell.org.uk>
[CCed to RT.cpan queue, in case you prefer it there] Sub::Uplevel's caller() misbehaves when you have several nested uplevel()ed functions. It also misbehaves more subtlely when you try to unwind the stack too far. The attached tests show this. It defines two functions: * firstlevel: a wrapper around caller * secondlevel: a wrapper around firstlevel It calls secondlevel() with no argument, then with 0, 1 and 2 in turn. It then wraps both functions and does the same, then compares the results. They're the same for no arg and 0, but differ for 1 (it gets the wrong function name) and 2 (when it tries to go too far up the stack). I found this when trying to make caller() work properly in Sub::WrapPackages. I'm sure we've talked about this before, but I'm now convinced that it's your bug :-) -- David Cantrell | Minister for Arbitrary Justice In this episode, R2 and Luke weld the doors shut on their X-Wing, and Chewbacca discovers that his Ewok girlfriend is really just a Womble with its nose chopped off.

Message body is not shown because sender requested not to inline it.

You can't use the ANON trick because it's local, which means that at any point you inspect the call stack, all anonymous functions have the same name. If you use Sub::Name to give them names instead, it works as you expect. The other bug is returning a list of undefs when it should be returning an empty list when looking above the call stack. I'm still trying to figure out why that is happening.
Ha. I finally looked at this again. The reason the undefs show up is that the code that cleans up line numbers autovivifies them: $wrapped_secondlevel_witharg2[2] = $secondlevel_witharg2[2]; I'm going to close this ticket. Sorry it only took me years to figure it out. :-/