|P is for Practical|
Re: Call perl script from within another perl scriptby pjf (Curate)
|on Sep 12, 2008 at 04:14 UTC||Need Help??|
I'd try using the FindBin module. This means that even if there's weird things going on with chroot and paths being rewritten, you should hopefully get the other script invoked:
This is assuming that your test1.pl is in the same directory as your calling script. If you're wondering what $^X is, it's the full path to your perl interpreter, which means the above line should work, even if Perl is not in your path.
I'm using the two-argument version of system, which means that if your host is a Unix-flavoured system, it should avoid the shell (and hence any problems where your script may not have a shell to run).
It's also recommended that you check the return value from system(), so if something does go wrong, you know about it. I personally use IPC::System::Simple for this task, which automates most of the checking and diagnostics, but being Perl there's more than one way to do it.
All the best,
Perl Training Australia