Hi guys, I am making a system call from perl for ContentCheck.pl and passing parameters with directories (having spaces). So I pass them in quotes, but they are not being picked up in the ContentCheck.pl file
Random.pm 1)
my $call = "$perlExe $contentcheck -t $target_path -b $base_path -o $output_path -s $size_threshold";
print "\ncall: ".$call."\n";
system($call);
Contentcheck.pl
use vars qw($opt_t $opt_b $opt_o $opt_n $opt_s $opt_h); # initialize
getopts('t:b:o:n:s:h') or do{
print "*** Error: Invalid command line option. Use option -h for help.\a\n";
exit 1};
if ($opt_h) {print $UsagePage; exit; }
my $tar;
if ($opt_t) {$tar=$opt_t; print "\ntarget ".$tar."\n";} else {
print " in target";
print
"*** Error: Invalid command line option. Use option -h for help.\a\n";
exit 1;}
my $base;
if ($opt_b) {$base=$opt_b;} else {
print "\nin base\n";
print "*** Error: Invalid command line option. Use option -h for help.\a\n";
exit 1;}
This is the output in the commandline
call: D:\tools\PacketCreationTool/bin/perl/winx64/bin/perl.exe D:/tools/PacketCr
eationTool/scripts/ContentCheck.pl -t "C:/Documents and Settings/pkkonath/Deskto
p/saved/myMockName.TGZ" -b "input file/myMockName.TGZ" -o myMockName.validate -s
10
target C:/Documents
in base
*** Error: Invalid command line option. Use option -h for help.
Any suggestions are welcome! Thanks.
2)When i pass it this way
my $call = "$perlExe $contentcheck -t \"$target_path\" -b \"$base_path\" -o $output_path -s $size_threshold";
print "\ncall: ".$call."\n";
system($call);
This is the output
call: D:\tools\PacketCreationTool/bin/perl/winx64/bin/perl.exe D:/tools/PacketCr
eationTool/scripts/ContentCheck.pl -t ""C:/Documents and Settings/pkkonath/Deskt
op/saved/myMockName.TGZ"" -b ""input file/myMockName.TGZ"" -o myMockName.validat
e -s 10
target C:/Documents
in base
*** Error: Invalid command line option. Use option -h for help.
3)
my $call = "$perlExe, $contentcheck, '-t', $target_path, '-b', $base_path, '-o', $output_path, '-s', $size_threshold";
print "\ncall: ".$call."\n";
system($call);
This is the output:
Can't open perl script ",": No such file or directory