Re: How can i make a perl program lauch another perl program that takes options On 6/29/07, Alex Jamestin  wrote:
snip
> my $vplan_parent_path = "\\/pdd\\/qes\\/vsuites\\/vplan";
snip

You don't need to escape those slashes.

snip
> system("perl $vplan_parent_path\\/vplan_all.pl") == 0
>    or die "perl blew up: $!";
snip

Same thing here.

snip
> And the o/p got is -
>
> vp_all: USAGE: perl vplan_all.pl   
>
> perl blew up: No such file or directory at test2.pl line 8.
>
>
> Interesting thing is, while perl locates the second perl prog
> successfully - it still calls die after that.
snip

You said before that it was supposed to die if it got no arguments, so
that is the expected behaviour.  As to why it keeps saying "No such
file or directory", well, if I remember correctly $! is the system
call errno, not the return from system.  I think you want $?
(specifically $? >> 8).  Here is what I think you want

system("perl vplan_all.pl 5.6 24.0 ajtest") == 0
    or die "vplan_all failed with an exit code of " . ($? >> 8);

-- 
To unsubscribe, e-mail: beginners-unsubscribe@perl.org
For additional commands, e-mail: beginners-help@perl.org
http://learn.perl.org/


