in reply to Can caller() or the call stack be tricked?
As noted above a goto allows you to omit your sub from the call stack. There's a price to pay though; control flow never returns to your sub.
use Carp qw(cluck); sub foo { cluck(1) }; sub bar { goto \&foo; carp "here" }; sub baz { bar() }; baz(); # bar() is not shown in the stack trace, # but "here" never gets carped!
For more powerful call stack trickery there's Sub::Uplevel (pure Perl, but slows down all uses of caller in your application) and Scope::Upper (even more powerful).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Can caller() or the call stack be tricked?
by Ralesk (Pilgrim) on Jul 08, 2013 at 21:56 UTC |