【发布时间】:2015-04-12 17:40:47
【问题描述】:
我需要知道我的函数是从哪个 perl 文件中调用的。假设我有以下模块 (MyModule.pm),它具有以下功能:
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 中做到这一点?
【问题讨论】:
标签: perl