简体   繁体   English

使用 ForkManager 在 Linux 上运行 Perl 脚本

[英]Running Perl script on Linux with ForkManager

I am trying to run Perl script on my vps serer that it gets the Ip title of text-file where text-file is a list of ips.我试图在我的 vps serer 上运行 Perl 脚本,它获取text-file的 Ip 标题,其中text-file是 ips 列表。 but i am getting this error :但我收到此错误:

 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.

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

my question is about how get this error fixed ?我的问题是如何修复这个错误? any help please任何帮助请

No way for us to know what $args[0] contains (or doesn't contain).我们无法知道$args[0]包含(或不包含)什么。 Please provide a full code snippet where the error is reproducible.请提供可重现错误的完整代码片段。

As for the ForkManager error: First, try instantiating the ForkManager object with its newer Moose-style arguments, ie.至于 ForkManager 错误:首先,尝试使用较新的 Moose 样式参数实例化 ForkManager 对象,即。 my $forkmanager = Parallel::ForkManager->new(max_procs => 200);

Also note that using the new keyword is discouraged.另请注意,不鼓励使用new关键字。 From perlobj :perlobj

Outside of the file handle case, use of this syntax is discouraged as it can confuse the Perl interpreter.在文件句柄情况之外,不鼓励使用此语法,因为它会混淆 Perl 解释器。 See below for more details.请参阅下面的更多细节。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM