| 1 | package Net::Z3950::UDDI::ResultSet; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | |||
| 5 | =head1 NAME | ||
| 6 | |||
| 7 | Net::Z3950::UDDI::ResultSet - back-end independent result-set for z2uddi | ||
| 8 | |||
| 9 | =head1 SYNOPSIS | ||
| 10 | |||
| 11 | $rs = new Net::Z3950::UDDI::ResultSet::uddi($db, $uddi_rs); # for example | ||
| 12 | $count = $rs->count(); | ||
| 13 | $record = $rs->record(0); | ||
| 14 | |||
| 15 | =head1 DESCRIPTION | ||
| 16 | |||
| 17 | A C<Net::Z3950::UDDI::ResultSet> object represents a result-set, the | ||
| 18 | result of search a backend database of some kind or another, but hides | ||
| 19 | the details of whether that database is a SOAP service or a UDDI | ||
| 20 | repostory (or something else again) by presenting a simple, generic | ||
| 21 | API. | ||
| 22 | |||
| 23 | =head1 METHODS | ||
| 24 | |||
| 25 | There is no constructor for C<ResultSet>, which is an abstract base | ||
| 26 | class. Each subclass has its own constructor, which will be called on | ||
| 27 | the application's behalf by the C<search()> method of the subclass's | ||
| 28 | corresponding C<Net::Z3950::UDDI::Database> subclass. | ||
| 29 | |||
| 30 | =head2 count() | ||
| 31 | |||
| 32 | $n = $rs->count(); | ||
| 33 | |||
| 34 | Returns the number of records in the result-set, i.e. the number of | ||
| 35 | records found by the search that created the result-set. | ||
| 36 | |||
| 37 | =head2 record() | ||
| 38 | |||
| 39 | foreach $i (0 .. $n-1) { | ||
| 40 | $rec = $rs->record($i); | ||
| 41 | } | ||
| 42 | |||
| 43 | Returns a single record from the result-set, indexed from zero. | ||
| 44 | |||
| 45 | =cut | ||
| 46 | |||
| 47 | |||
| 48 | # Do not call directly: subclasses invoked this as SUPER::new() | ||
| 49 | sub new { | ||
| 50 | my $class = shift(); | ||
| 51 | my($db) = @_; | ||
| 52 | |||
| 53 | return bless { | ||
| 54 | db => $db, | ||
| 55 | }, $class; | ||
| 56 | } | ||
| 57 | |||
| 58 | |||
| 59 | sub db { shift()->{db} } | ||
| 60 | |||
| 61 | |||
| 62 | # Delegate | ||
| 63 | sub _throw { | ||
| 64 | my $this = shift(); | ||
| 65 | return $this->db()->_throw(@_); | ||
| 66 | } | ||
| 67 | |||
| 68 | |||
| 69 | =head1 SUBCLASSING | ||
| 70 | |||
| 71 | I<###> to be written | ||
| 72 | |||
| 73 | =head1 SEE ALSO | ||
| 74 | |||
| 75 | C<Net::Z3950::UDDI::Database> | ||
| 76 | is the module that immediately uses this. | ||
| 77 | |||
| 78 | =head1 AUTHOR, COPYRIGHT AND LICENSE | ||
| 79 | |||
| 80 | As for C<Net::Z3950::UDDI>. | ||
| 81 | |||
| 82 | =cut | ||
| 83 | |||
| 84 | 1; |