in reply to Executing perl script from perl scripts

In a test file you should call the scripts in the same what that cron does, which is through a system call or the shell.

You can do that in perl like this:

system($^X, '1.pl'); # and check for system's return value! ok(1, 'Test 1'); system($^X, '2.pl'); ok(2, 'Test 1');

If you want to process the script output, use

my $res = qx($^X 1.pl); chomp $res; is($res, 1, '1.pl worked'); $res = qx($^X 2.pl); chomp $res; is($res, 2, '2.pl worked');

($^X is the path of the current perl interepreter)

Replies are listed 'Best First'.
Re^2: Executing perl script from perl scripts
by palette (Scribe) on Jun 18, 2008 at 06:32 UTC
    Getting an error on executing 1.pl should throw error telling that 1.pl is errored. 1.pl might not return a value '1'. What can be done in that case.
Re^2: Executing perl script from perl scripts
by palette (Scribe) on May 16, 2008 at 10:26 UTC
    If I want to run 1.pl with one version of perl and the 2.pl with another version of perl how can I do that
      system qw(perl5.8.8 1.pl); system qw(perl5.10.0 2.pl);
      /first_perl_location/bin/perl 1.pl /second_perl_location/bin/perl 2.pl
      Cheers,
      Rob