これが私が使用しているスケルトンスクリプトです:
#!/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)にインストールできないため、IPC::Systemを使用できません。私がやろうとしているのは、perlスクリプトを実行してプロセスを実行したり、データベーステーブルを監視したりする、perlテストハーネスを開発することです。また、実行結果に基づいて、これらのスクリプトのタイミングを制御することもできます。
考えられる解決策の1つ:@ARGVに基づいてスクリプトをN回実行する場合
foreach (1..$ARGV[0])
{
print "hello \n";
}