The stupid question is the question not asked | |
PerlMonks |
Re^2: Executing one script with anotherby socketdave (Curate) |
on Jul 14, 2005 at 19:33 UTC ( [id://475024]=note: print w/replies, xml ) | Need Help?? |
You're right about system() waiting for a child process to complete, but exec() works differently. It basically calls the program that you specify and kills the script that's currently running (unless the command can't run, in which case it will return false and put something interesting in $!). Generally I'd use exec() after forking, and use system() when you expect your external command to return in a timely fashion (In fact, system forks then execs and waits for the child to return before giving control back to the script). If you want to display an animated 'waiting' gif or something like it, system() would probably be the one you want.
In either case, you should enclose your command in quotes or generate an array with your command as the first element and it's arguments as the remaining elements: system("/path/to/BlastTool my params here") or die "Could not run command"; or:
In Section
Seekers of Perl Wisdom
|
|