Ransom has asked for the wisdom of the Perl Monks concerning the following question:
Hey Monks
I've got a system I'm working on consisting of several listings that I've been working on to solve certain parts of the problem. The general format is as follows:
#! /usr/bin/perl package diskman::runner; use strict; use warnings; use XML::Simple; # Accept arguments from the config.xml file my $args = XMLin('config/config.xml') or die "Can not read config.xml\ +n"; # Run the HP utility on every server in the config file foreach my $server (@{$args->{server}}) { system(qq[wine "/home/nathan/.wine/drive_c/Program\ Files/HP\ Remo +te\ System\ Management/"hprsmcli.exe -s $server -u $args->{user} -p $ +args->{pass} -f $args->{fmt} -o $args->{winepath}.$server -t $args->{ +options}]); } # Script is done print "Runner Done\n";
I've got 4 listings like this that I need to tie together in one script. This question is about my options for achieving such a package
Firstly, I know of system, exec, and backticks. If I run it using one of those, how do I know the script was successful and didn't die? Do warnings come back to my "main script"?. Secondly, what is the advantage of the package system? I'm thinking that I didn't design the listings as "modules" in a way that I can interface with them with use. I would just like to run them and return to the main script with some indication of failure or success. Do I need to use any package/use syntax?Ransom
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Running script from script
by blue_cowdawg (Monsignor) on Jul 11, 2012 at 15:12 UTC | |
by Ransom (Beadle) on Jul 11, 2012 at 15:21 UTC | |
by blue_cowdawg (Monsignor) on Jul 11, 2012 at 15:29 UTC | |
|
Re: Running script from script
by aitap (Curate) on Jul 11, 2012 at 15:03 UTC | |
by Ransom (Beadle) on Jul 11, 2012 at 15:10 UTC | |
|
Re: Running script from script
by RedElk (Hermit) on Jul 11, 2012 at 15:26 UTC |