The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

perfSONAR_PS::Services::MP::Agent::Script - A module that will run a given script and return it's output.

DESCRIPTION

Inherited perfSONAR_PS::Services::MP::Agent::Base class that allows a command to be executed. Specific tools should inherit from this class and override parse() in order to be able to format the command line output in a well understood data structure.

SYNOPSIS

  # create and setup a new Agent  
  my $agent = perfSONAR_PS::Services::MP::Agent::Script( $command, $options );
  $agent->init();
  
  # collect the results (i.e. run the command)
  if( $mp->collectMeasurements() == 0 )
  {
        
        # get the raw datastructure for the measurement
        print "Results:\n" . $self->results() . "\n";

  }
  # opps! something went wrong! :(
  else {
    
    print STDERR "Command: '" . $self->commandString() . "' failed with result '" . $self->results() . "': " . $agent->error() . "\n"; 
    
  }

new( $command, $options )

Creates a new agent class

  $command = complete path to command line tool to run, eg /bin/myScript.pl
  $arguments = string of arguments to supply to above script.

command( $string )

accessor/mutator function for the script to execute

arguments( $string )

accessor/mutator function for the arguments to be supplied to the script

init( )

does anything necessary before running the collect() such as modifying the options etc. Check to see that the script exists

collectMeasurements( )

Runs the command with the options specified in constructor.

Returns:

 -1 = something failed
  0 = command ran okay

on success, this method should call the parse() method to determine the relevant performance output from the script.