这是我正在使用的骨架脚本:
#!/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
skahmed@mmm.com
=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::System,因为我无法将它安装在我正在运行它的主机(ubuntu 12.04)上。我想做的是开发一个 perl 测试工具,它将运行 perl 脚本来运行进程、监视数据库表等,我还可以根据我从它们的执行中获得的结果来控制这些脚本的时间。
一种可能的解决方案:基于@ARGV 运行脚本 N 次
foreach (1..$ARGV[0])
{
print "hello \n";
}