The Harvest system also comes with a library interface to SOIF written in Perl. The soif.pl Perl library is located in $HARVEST_HOME/lib. The soif.pl library will parse a SOIF object into an associative array, and will print an associative array as a SOIF object. The following example code will read a stream of SOIF objects from STDIN, and for each object it will add a Print-Time attribute then print the SOIF object to STDOUT:
require 'soif.pl'; $soif'input = 'STDIN'; # defaults to STDIN $soif'output = 'STDOUT'; # defaults to STDOUT while (($ttype, $url, %SOIF) = &soif'parse()) { next if (%SOIF == ()); $SOIF{'Print-Time'} = time; &soif'print($ttype, $url, %SOIF); }