in reply to subroutine tracking
Is there an easy way when calling a subroutine to determine what called that subroutine?There sure is and it's called caller().
Check out the caller() docs for more info on this funky little function.sub foo { print "calling bar()", $/; bar(); } sub bar { print "in bar()", $/; print "called by - ", (caller(1))[3], $/; } foo(); __output__ calling bar() in bar() called by - main::foo
_________
broquaint
|
|---|