Perl: > and >>
This format reads each command line argument (using the shift function) into a local scalar variable. Then it opens a text file for output and writes the command line arguments to the file. (The >>$out_filename, the '>>' specifies that the text should be appended to the file. To overwrite, use '>'.)
If the event occurred once, the output looks like the following example.
perl_out.txt after event occurred once
Command line args : FARGO FARGO INVENTORY CurrentQDepth 10
If this event fired multiple times, the output looks like the following example.
perl_out.txt after event occurred multiple times
Command line args : MADRID MADRID ORDERS CurrentQDepth 23
Command line args : MADRID MADRID ORDERS CurrentQDepth 34
Command line args : FARGO FARGO INVENTORY CurrentQDepth 2
Command line args : FARGO FARGO INVENTORY CurrentQDepth 6
Command line args : FARGO FARGO INVENTORY CurrentQDepth 10
The following example shows the example code with the current time added.
Perl script with the current time
$inst_path = $QPASA_VARS[0]->{path};
$value = $QPASA_VARS[0]->{value};
($host_name, $qmgr_name, $queue_name, $attr_name) = split /!/, $inst_path ;
$output = "write_to_file.pl $host_name $qmgr_name $queue_name $attr_name ";
$output .= "$value ";
$time = scalar localtime;
$output .= "\"$time\"";
$QPASA_OUTPUT = $output;