小编ave*_*lon的帖子

如何仅从Perl程序的主程序包获取跟踪输出

我想跟踪我的Perl脚本,但只包含代码main,并将输出重定向到文件.

使用perl -d script.pl它启动脚本时会进入交互模式.

我试过了

perl -d:Trace perl_05.pl 2&> output.log
Run Code Online (Sandbox Code Playgroud)

但是这也跟踪了我不想要的所有子程序和模块.

我正在寻找类似bash set -o xtrace或者的东西sh -x.

debugging perl

6
推荐指数
2
解决办法
384
查看次数

如何使用DateTime获取当月的最后一天?

我的任务是计算当月的最后一天.

有一种方法last_day_of_month日期时间.你可以这样称呼它:

$av_tmp_TODAY = DateTime->last_day_of_month({year=>2016,month=>05});
Run Code Online (Sandbox Code Playgroud)

但我不想设定固定的年份和月份,我只想采取今天的日期并获得该月的最后一天.

另外,我希望我的输出格式%Y-%m-%d.

perl datetime

2
推荐指数
1
解决办法
1477
查看次数

如何在 Log::Log4perl 配置文件中使用 Perl 变量?

I would like to use a Perl variable from my script in a Log::Log4perl config file. I read the documentation and found that I can use a subroutine, but I would like to do it a little bit simpler, if possible.

I want to set the filename for my appender:

log4perl.appender.av_std_LOGFILE.filename="whateverfilename.log"
Run Code Online (Sandbox Code Playgroud)

But doing this this way, it is a fixed value.

I have the filename in a variable within my script and would like to use this at runtime:

log4perl.appender.av_std_LOGFILE.filename=\ …
Run Code Online (Sandbox Code Playgroud)

perl hook log4perl

1
推荐指数
1
解决办法
889
查看次数

标签 统计

perl ×3

datetime ×1

debugging ×1

hook ×1

log4perl ×1