Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Run a remote Perl script from within a Perl script with @ARGV

by charithd (Novice)
on Sep 26, 2012 at 04:38 UTC ( #995695=perlquestion: print w/ replies, xml ) Need Help??
charithd has asked for the wisdom of the Perl Monks concerning the following question:

Hi all, I need to execute remote perl script(script_to_call.pl) from my another perl script also passing @ARGV to script_to_call.pl . I tried with below but it not parse @ARGV:
do { local @ARGV; @ARGV = ("$OldTime","$NewTime","$WLSP/CDSServer11.log"); eval { system("ssh -o stricthostkeychecking=no $WLS './script_to_call. +pl'"); }; };

Comment on Run a remote Perl script from within a Perl script with @ARGV
Download Code
Re: Run a remote Perl script from within a Perl script with @ARGV
by Athanasius (Monsignor) on Sep 26, 2012 at 04:56 UTC

    Try this (untested):

    my @args = ('ssh', '-o', 'stricthostkeychecking=no', $WLS, './script_to_call.pl', $OldTime, $NewTime, "$WLSP/CDSServer11.log"); system(@args);

    @ARGV contains what was passed in on the command line. It is not used for passing to another script. See system.

    Hope that helps,

    Athanasius <°(((><contra mundum

Re: Run a remote Perl script from within a Perl script with @ARGV
by salva (Monsignor) on Sep 26, 2012 at 08:24 UTC
    use Net::OpenSSH; $s = Net::OpenSSH->new($WLS, master_opts => [-o => 'StrictHostKeyCheck +ing=no']); $s->system('./script_to_call.pl', $OldTime, $NewTime, "$WLSP/CDSServer +11.log");

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://995695]
Approved by Athanasius
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (9)
As of 2014-09-23 08:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (211 votes), past polls