Added documentation and test for the IDZebra::Resultset object
[idzebra-moved-to-github.git] / perl / lib / IDZebra / RetrievalRecord.pm
index e142932..efbf906 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: RetrievalRecord.pm,v 1.1 2003-03-03 00:45:37 pop Exp $
+# $Id: RetrievalRecord.pm,v 1.2 2003-03-03 12:14:27 pop Exp $
 # 
 # Zebra perl API header
 # =============================================================================
@@ -9,13 +9,26 @@ use warnings;
 
 BEGIN {
     use IDZebra;
-    our $VERSION = do { my @r = (q$Revision: 1.1 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; 
+    our $VERSION = do { my @r = (q$Revision: 1.2 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; 
 }
 
+1;
+# =============================================================================
+# THIS IS Just the documentation, and some access methods... 
+# The real code is autogenerated by SWIG in IDZebra.pm
 # =============================================================================
-# THIS IS Just the documentation, the real code is autogenerated by SWIG in
-# IDZebra.pm
+
+sub errCode   { $_[0]->{errCode} }
+sub errString { $_[0]->{errString} }
+sub position  { $_[0]->{position} }
+sub base      { $_[0]->{base} }
+sub sysno     { $_[0]->{sysno} }
+sub score     { $_[0]->{score} }
+sub format    { $_[0]->{format} }
+sub buf       { $_[0]->{buf} }
+
 # =============================================================================
+
 __END__
 
 =head1 NAME
@@ -24,10 +37,64 @@ IDZebra::RetrievalRecord - Structure representing a retrieval record
 
 =head1 SYNOPSIS
 
+  foreach my $rec ($rs1->records()) {
+      unless ($rec->errCode) {
+         printf  ("Pos:%d, Base: %s, sysno: %d, score %d format: %s\n%s\n\n",
+             $rec->position,
+             $rec->base,
+             $rec->sysno,
+             $rec->score,
+             $rec->format,
+             $rec->buf
+         );
+      }
+  }
+
+
 =head1 DESCRIPTION
 
+The object represents a Zebra retrieval record, as a "member" of a resultset. It's a read-only object. Beeing a tied reference, access to undefined members ("properties") may hurt.
+
 =head1 PROPERTIES
 
+The following properties are available trough both methods ($rec->errCode) and hash members ($rec->{errCode}):
+
+=over 4
+
+=item B<errCode>
+
+The error code received when fetching this record. 0, if everything went OK.
+
+=item B<errString>
+
+Supplemental error information if applicable.
+
+=item B<position>
+
+Position of record in the resultset.
+
+=item B<base>
+
+The database the record belongs to
+
+=item B<sysno>
+
+System number (unique identifier provided by Zebra for each record) 
+
+=item B<score>
+
+The score of the resulting record
+
+=item B<format>
+
+Record format, (Z39.50)
+
+=item B<buf>
+
+The record data itself
+
+=back
+
 =head1 COPYRIGHT
 
 Fill in
@@ -42,4 +109,3 @@ IDZebra, IDZebra::Session, IDZebra::Resultset, Zebra documentation
 
 =cut
 
-1;