View on
MetaCPAN is shutting down
For details read Perl NOC. After June 25th this page will redirect to
Aaron Brown > perfSONAR_PS-Services-PingER-0.09 > perfSONAR_PS::Services::MP::Agent::Script



Annotate this POD

View/Report Bugs
Module Version: 0.09   Source  


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


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.


  # create and setup a new Agent  
  my $agent = perfSONAR_PS::Services::MP::Agent::Script( $command, $options );
  # 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/
  $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.


 -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.

syntax highlighting: