Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: Executing perl script from perl scripts

by moritz (Cardinal)
on May 15, 2008 at 13:11 UTC ( #686725=note: print w/replies, xml ) Need Help??

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, ''); # and check for system's return value! ok(1, 'Test 1'); system($^X, ''); ok(2, 'Test 1');

If you want to process the script output, use

my $res = qx($^X; chomp $res; is($res, 1, ' worked'); $res = qx($^X; chomp $res; is($res, 2, ' 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 should throw error telling that is errored. 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 with one version of perl and the with another version of perl how can I do that
      system qw(perl5.8.8; system qw(perl5.10.0;
      /first_perl_location/bin/perl /second_perl_location/bin/perl

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://686725]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (1)
As of 2023-10-03 01:55 GMT
Find Nodes?
    Voting Booth?

    No recent polls found