next up previous contents index
Next: C Gatherer Examples Up: B.3 Using the SOIF Previous: SOIF library written

SOIF library written in Perl

     

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);
        }

 

 


next up previous contents index
Next: C Gatherer Examples Up: B.3 Using the SOIF Previous: SOIF library written



Darren Hardy
Mon Apr 3 15:22:37 MDT 1995