这里是我使用的骨架脚本:如何运行的时候一个Perl脚本,N多内的perl脚本
#!/usr/bin/env perl
=head1 NAME
webapp-1 harness - webapp-1 test
=head1 SYNOPSIS
webapp-1 [OPTION]
-v, --verbose use verbose mode
--help print this help message
Where OPTION is an integer governing the number of times the script should be run
Examples:
webapp-1 10
=head1 DESCRIPTION
This is test harness to verify jira issue WEBAPP-1
=head1 AUTHOR
[email protected]
=cut
use strict;
use warnings;
use Getopt::Long qw(:config auto_help);
use Pod::Usage;
my $count = $ARGV;
main();
sub main {
# Argument parsing
my $verbose;
GetOptions(
'verbose' => \$verbose,
) or pod2usage(1);
pod2usage(1)unless @ARGV;
while ($count) {
printf "$count \n";
# Here i want to run a perl script N number of times, with N being the ARGV to this command
# capture([0,1,2, $^X, "yourscript.pl", @ARGS);
$count++;
}
}
我也不能使用IPC ::系统,因为我不能在主机上安装它(Ubuntu的12.04)我正在运行它。 什么,我试图做的是开发一个Perl的测试功能,这将运行perl脚本运行过程,监控数据库表,等等,我还可以控制这些脚本的,时机成果的基础上,我从他们的执行得到。
一个可能的解决方案:用于运行基于@ARGV
foreach (1..$ARGV[0])
{
print "hello \n";
}
看看:http://stackoverflow.com/questions/364842/how-do-i-run-a-perl-script-from-within-a-perl-script?rq=1 – Paul
请可以您是否澄清了安装模块时遇到的困难?也许我们可以克服这一点。 “IPC :: System”也是它的确切名称吗? [为其搜索MetaCPAN]时,不会出现该名称的模块(https://metacpan.org/search?q=IPC%3A%3ASystem)。 – Smylers
@Smylers它的IPC ::系统::简单 如果我使用cpanminus,我将不得不根,或具有root权限,安装模块,我不能由操作员获得 – kamal