Re: How can i make a perl program lauch another perl program that takes options
- From: iaccounts@xxxxxxxxxx (Steve Bertrand)
- Date: Fri, 29 Jun 2007 08:39:55 -0400
alex.jamestin+usenet@xxxxxxxxx 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
.
- References:
- How can i make a perl program lauch another perl program that takes options
- From: Alex.Jamestin+Usenet@xxxxxxxxx
- How can i make a perl program lauch another perl program that takes options
- Prev by Date: Re: using a homemade perl module
- Next by Date: Re: parse help
- Previous by thread: How can i make a perl program lauch another perl program that takes options
- Next by thread: Re: How can i make a perl program lauch another perl program that takes options
- Index(es):
Relevant Pages
|