3
我需要知道从哪个perl文件调用了我的函数。比方说,我有一个具有以下功能如下模块(MyModule.pm
):如何知道从哪个perl模块或文件调用该函数
package MyModule;
sub myFunc{
# Here I need to print the name of the file that the function was called from
}
和脚本myScript.pl
使用MyModule
并调用函数myFunc()
:
use MyModule;
MyModule->myFunc();
我在这里需要调用myFunc()
到打印“myScript.pl
”
有什么办法可以在Perl中做到这一点?