in reply to Usage gathering query
with a subroutine like this:MODEL=`/opt/adi/bin/adcat.py -x computer $HOST|grep Model|awk '{print + $3}'`
Even if the initial implementation of this routine is the same as the shell version, by creating this interface you'll be able to change the implementation later. This routine might also be useful in other scripts.sub get_model { my $host = shift; ... }
You can attempt the same refactoring with shell functions, but you won't be able to pass around complex data structures which will prove to be limiting. For instance, it is clear that the adcat.py returns a lot of information about a host, and being able to pass that information back as a hash is much more efficient (and natural) than writing separate get routines for each attribute.
If you need help using Net::SSH or Net::SSH::Perl, just let us know.
|
|---|