| Net-Delicious documentation | Contained in the Net-Delicious distribution. |
Net::Delicious::Iterator - iterator class for Net::Delicious thingies
use Net::Delicious::Iterator;
my @dates = ({...},{...});
my $it = Net::Delicious::Iterator->new("Date",\@dates);
while (my $d = $it->next()) {
# Do stuff with $d here
}
Iterator class for Net::Delicious thingies
It isn't really expected that you will instantiate these objects outside of Net::Delicious itself.
Returns a Net::Delicious::Iterator object. Woot!
Return the number of available thingies.
Returns the next object in the list of available thingies. Woot!
1.13
$Date: 2008/03/03 16:55:04 $
Aaron Straup Cope <ascope@cpan.org>
Copyright (c) 2004-2008 Aaron Straup Cope. All rights reserved.
This is free software, you may use it and distribute it under the same terms as Perl itself.
| Net-Delicious documentation | Contained in the Net-Delicious distribution. |
# $Id: Iterator.pm,v 1.14 2008/03/03 16:55:04 asc Exp $ use strict; package Net::Delicious::Iterator; $Net::Delicious::Iterator::VERSION = '1.14';
sub new { my $pkg = shift; return bless {pkg=>$_[0], data=>$_[1], count=>0}, $pkg; }
sub count { my $self = shift; return scalar @{$self->{data}}; }
sub next { my $self = shift; if (my $data = $self->{data}->[$self->{count}++]) { return $self->{pkg}->new($data); } } sub reset { my $self = shift; $self->{count} = 0; }
return 1;