NAME
perfSONAR_PS::Services::MP::Agent::ConstantValue - A perfsonar MP Agent class that returns a constant value.
DESCRIPTION
This module returns a constant value. It inherits from perfSONAR_PS::MP::Agent::Base to provide a consistent interface.
SYNOPSIS
# create and setup a new Agent
my $agent = perfSONAR_PS::Services::MP::Agent::ConstantValue( 5 );
# 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( $value )
Creates a new agent class
$value = constant value to set
init()
No initiation needed, do nothing
collectMeasurements( )
Always okay as long as the constant value is set.
-1 = something failed
0 = command ran okay
results( )
Returns the results (ie the constant value assigned in the constructor). No need to redefine here as it's inherited.