- 我正在将一个日志框架集成到我的 perl 项目中,该项目有大约 300 个 Perl 文件。
- 因此,我编写了一个模块,该模块
Logging.pm具有被覆盖die的 ,say,warn功能,并且由于print无法被覆盖,因此我将其绑定为我的自定义句柄。 - 我有一个主脚本
execute.pl,它通过system//执行所有脚本qx。exec - 我想
Logging.pm在execute.pl 通过or or 执行的子进程中包含execute.pl所有功能 。Logging.pmsystem()qx()exec()
执行示例:
execute.pl -> system("test1.pl") -> system("test2.pl")
因此,test1.pl如果test2.pl我die/warn/say/print只包含Logging.pm在excute.pl.
据我所知system/qx/exec,将是操作系统调用并且Logging.pm在子进程中不可用,有什么办法可以实现这一点,因为我不想编辑 300 个文件?