Is there a way I can access (for printout) a list of sub + module to arbitrary depth of sub-calls preceding a current position in a Perl script?
I need to make changes to some Perl modules (.pm's). The workflow is initiated from a web-page thru a cgi-script, passing input through several modules/objects ending in the module where I need to use the data. Somewhere along the line the data got changed and I need to find out where.
This code works without any additional modules. Just include it where needed.
One that is more pretty: Devel::PrettyTrace
caller can do that, though you may want even more information than that.
You can use Devel::StackTrace.
It behaves like Carp's trace, but you can get more control over the frames.
The one problem is that references are stringified and if a referenced value changes, you won't see it. However, you could whip up some stuff with PadWalker to print out the full data (it would be huge, though).
There's also
Carp::confess
andCarp::cluck
.Carp::longmess
will do what you want, and it's standard.I came up with this sub (Now with optional blessin' action!)