mar*_*ton 34
The special symbol __PACKAGE__ contains the current package,
but cannot (easily) be used to construct variable names.
Run Code Online (Sandbox Code Playgroud)
ike*_*ami 10
__PACKAGE__ 将为您提供编译代码的包.
或者,您可能想要caller.它获取调用当前sub的代码包.
package Report;
sub gen_report {
my $report = "This report is generated for ".caller().".\n"; # MyModule
...
}
package MyModule;
Report::gen_report();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9900 次 |
| 最近记录: |