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.