Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
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
Replies are listed 'Best First'.
Re: Run a remote Perl script from within a Perl script with @ARGV
by Athanasius (Abbot) 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 (Abbot) 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 perusing the Monastery: (12)
As of 2015-07-31 17:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (279 votes), past polls