I have written a Perl API and it is used by many programs across teams. I want to track all programs calling my API method. I want to have something like the below
debug("The calling method is ", $XXXX);
How to get $XXXX ?
I have written a Perl API and it is used by many programs across teams. I want to track all programs calling my API method. I want to have something like the below
debug("The calling method is ", $XXXX);
How to get $XXXX ?
Also see the functions in the Carp
module, which wrap the caller
function and can serve as a sort of warn function with caller information.
use Carp qw(carp cluck);
carp "This function was called from "; # caller info will be appended to output
cluck "The full stack trace up to this point is ";