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


In reply to Running script from script by Ransom

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.