[EMAIL PROTECTED] wrote:
> Hi all,
> 
> Any help on this would be appreciated :)
> 
> Currently I have a perl program thats required to call another perl
> program. The second one takes arguments and can be called as:
> 
>             perl vplan_all.pl 5.6 24.0 ajtest
> 
> Here 5.6, 24.0 and ajtest are all command line options.
> 
> I have to call this from a second program that i wrote. I tried the
> call as below -
> 
>           system( "perl vplan_all.pl 5.6 24.0")
>             or die "Couldn't run the vplan_all.pl script: $!\n";
> 
> However, this doesn't seem to work. The shell reports that perl can't
> find the file. However, when i simply try with -
> 
>           system( "perl vplan_all.pl")
>             or die "Couldn't run the vplan_all.pl script: $!\n";
> 
> The script is now called and i get the result -
> 
>           vp_all: USAGE: perl vplan_all.pl <Version> <Build>
> <File_name_to_be_created>
> 
> which is the expected behaviour when no options are provided.
> So apparently the shell calls perl and passes the entire "perl
> vplan_all.pl 5.6 24.0" as a chunk. Perl can't then seem to
> differentiate between the code name and the options.
> 
> I've tried bypassing the shell [ system(xxx,xxx,xx)] but that doesn't
> seem to help.

If vplan_all.pl is in fact it's own application, try calling it without
calling Perl first:

system("/path/to/program/vp_all.pl arg1 arg2") or die "blah blah: $!";

BTW, AFAIR, inserting a \n after the $! will negate the $!, but I may be
mistaken.

Steve

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to