>>>>>>>>>>>>>>>>>
package first ;
sub first_one {print "1\n" ; first_two()} ;
sub first_two {print "2\n" ; print join(':', caller()) . "\n"} ;
our @x ;
package second ;
$import_from = 'first' ;
for $symbole_name (keys %{"$import_from\::"})
{
local *symbole = "$import_from\::"->{$symbole_name} ;
print "$symbole_name " ;
if(defined *symbole{CODE})
{
print "is code" ;
*{__PACKAGE__ . "\::$symbole_name"} = \&{"$import_from\::$symbole_name"} ;
}
print "\n" ;
}
first_one() ;
<<<<<<<<<<<<<<<<<<<<<<<<<<<
####
SetPackageAndCall("ihha", \&first_one, arg1, arg2)
####
>>>>>>>>>>
package first ;
sub first_one
{
my $package = shift ;
SetMyPackage($package) ;
first_two() ;
}
sub first_two
{
sub first_two {print "2\n" ; print join(':', caller()) . "\n"} ;
}
package second ;
# import the subs as before
first_one('a_completely_diffrent_package') ;
<<<<<<<<<<<<<<
the above would print:
a_completely_diffrent_package:/home/nadim/Desktop/test.pl:4
I'm all ears, Nadim.
PS. there is a practical use that I'll gladely if someone is
interrested.