CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
issue in calling perl script multiple times from another perl script

 



hisudhir007
New User

Jul 20, 2012, 6:32 AM

Post #1 of 3 (1265 views)
issue in calling perl script multiple times from another perl script Can't Post

hi

My code look like this
@list = qw {one two};

foreach my $name (@list)
{
system("perl run.pl $name");
}

Issue is run.pl is not running completely. It runs and appeared tobe finished in a second. Both time it looks like running for a while and exiting. If I run the script manully it runs properly.
How to call the script second time only after the first one is completed.?


Laurent_R
Veteran / Moderator

Jul 22, 2012, 1:51 PM

Post #2 of 3 (1252 views)
Re: [hisudhir007] issue in calling perl script multiple times from another perl script [In reply to] Can't Post

If you are using


Code
system("perl run.pl $name");


your program is supposed to wait for the execution of run.pl before going to the next step in the loop. With the 'system' instruction, the parent process waits for the child process to complete before proceeding.

Maybe the problem is in the run.pl program.


(This post was edited by Laurent_R on Jul 22, 2012, 1:55 PM)


wickedxter
User

Jul 22, 2012, 4:59 PM

Post #3 of 3 (1243 views)
Re: [hisudhir007] issue in calling perl script multiple times from another perl script [In reply to] Can't Post

make sure the directory is included to the perl script and that you're useing the array @ARGV to get the name you supplied as the argument..


Code
system "perl /home/blah/cgi-bin/run.pl $name"; 

or

system "perl c:/folder/to/file/run.pl $name";


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives