gpt4 book ai didi

linux - 使用 ForkManager 在 Linux 上运行 Perl 脚本

转载 作者:太空宇宙 更新时间:2023-11-04 05:13:10 27 4
gpt4 key购买 nike

我正在尝试在我的 vps 服务器上运行 Perl 脚本,它获取 text-file 的 Ip 标题,其中 text-file 是 ip 列表。但我收到此错误:

 Use of uninitialized value $args[0] in pattern match (m//) at /usr/local/share/perl5/Parallel/ForkManager.pm line 73.
Missing required arguments: max_proc at ./get line 12.

其中第 73 行是 if ( $args[0] =~/^\d+$/) {第 12 行是 my $forkmanager = new Parallel::ForkManager->new("200");

我的问题是如何修复此错误?请提供任何帮助

最佳答案

我们无法知道 $args[0] 包含(或不包含)什么。请提供可重现错误的完整代码片段。

至于 ForkManager 错误:首先,尝试使用较新的 Moose 风格参数实例化 ForkManager 对象,即。 我的 $forkmanager = Parallel::ForkManager->new(max_procs => 200);

另请注意,不鼓励使用 new 关键字。来自 perlobj :

Outside of the file handle case, use of this syntax is discouraged as it can confuse the Perl interpreter. See below for more details.

关于linux - 使用 ForkManager 在 Linux 上运行 Perl 脚本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52832431/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com