Permalink
Browse files

documentation of Collection

  • Loading branch information...
1 parent 8da9b51 commit 137b020f5944b9e1c2ba7df2504c0aceb79c7d76 @moritz committed Jun 19, 2011
Showing with 39 additions and 0 deletions.
  1. +39 −0 lib/WebService/Libris/Collection.pm
@@ -42,4 +42,43 @@ sub elems {
scalar @{ shift->ids }
}
+=head1 NAME
+
+WebService::Libris::Collection - iterable collection of objects
+
+=head1 SYNOPSIS
+
+ use WebService::Libris;
+ my $collection = WebService::Libris->search(term => 'blomkvist');
+ while (my $book = $collection->next) {
+ # do something with $book
+ }
+
+=head1 DESCRIPTION
+
+WebService::Libris::Collection objects hold list of objects of subclasses of
+L<WebService::Libris>. It is used instead of arrays because it delays requests
+to the libris.kb.se web API until an object is actually access.
+
+=head1 METHODS
+
+=head2 first
+
+Returns the first item
+
+=head2 next
+
+Returns the next item, and removes it from the internal list of items, so that
+repeated calls to C<next> iterate over the whole collection
+
+=head2 all
+
+Returns a list of all remaining objects in the collection
+
+=head2 elems
+
+Returns the number of remaining objects in the collection
+
+=cut
+
1;

0 comments on commit 137b020

Please sign in to comment.