package MyLib;
our $MyLibrarysGlobalCallStackInformation;
sub myfunc1
{
local $MyLibrarysGlobalCallStackInformation = $somedata;
myfunc2();
}
sub myfunc2
{
# use $MyLibrarysGlobalCallStackInformation here
}
####
package MyLib;
sub myfunc1
{
myfunc2($somedata);
}
sub myfunc2
{
my ($somedata) = @_;
# use $somedata here
}
####
package MyLib;
sub myfunc1
{
my (@args) = @_;
return myfunc2(@args, $somedata); #instead of goto &myfunc2
}
sub myfunc2
{
my ($arg1, $arg2, $arg3, $somedata) = @_;
if (defined $somedata) {
.. # we got there from myfunc1
}
}