NAME
WWW::Ohloh::API::Projects - a set of Ohloh projects
SYNOPSIS
use
WWW::Ohloh::API;
my
$ohloh
= WWW::Ohloh::API->new(
api_key
=>
$my_api_key
);
my
$projects
=
$ohloh
->get_projects(
query
=>
'Ohloh'
,
max
=> 100 );
while
(
my
$p
=
$projects
->
next
) {
$p
->name;
}
DESCRIPTION
W::O::A::Projects returns the results of an Ohloh project query. To be properly populated, it must be created via the get_projects
method of a WWW::Ohloh::API object.
The results of a query are not all captured at the call of <get_projects>, but are retrieved from Ohloh as required, usually by batches of 25 items.
METHODS
next( [ $n ] )
Return the next project of the set or, if $n is given, the $n following projects (or all remaining projects if they are less than $n). When all projects have been returned, next()
returns undef
once, and then restarts from the beginning.
Examples:
# typical iterator
while
(
my
$project
=
$projects
->
next
) {
$project
->name;
}
# read projects 10 at a time
while
(
my
@p
=
$project
->
next
( 10 ) ) {
# do something with them...
}
all
Return all the remaining projects of the set. A call to all()
immediatly reset the set. I.e., a subsequent call to next()
would return the first project of the set, not undef.
As a precaution against memory meltdown, calls to all()
are not permited unless the parameter max of get_projects
has been set.
Example:
my
$projects
=
$ohloh
->get_projects(
sort
=>
'stack_count'
,
max
=> 100 );
# get the first project special
$top
=
$projects
->
next
;
# get the rest
@most_stacked
=
$projects
->all;
OVERLOADING
Iteration
If called on a W:O:A:Projects object, the iteration operator (<>) acts as a call to '$projects->next'.
E.g.,
while
(
my
$p
= <
$projects
> ) {
### do stuff with $p
}
SEE ALSO
WWW::Ohloh::API, WWW::Ohloh::API::Project, WWW::Ohloh::API::Analysis, WWW::Ohloh::API::Account.
Ohloh API reference: http://www.ohloh.net/api/getting_started
Ohloh Account API reference: http://www.ohloh.net/api/reference/project
VERSION
This document describes WWW::Ohloh::API version 1.0_0
BUGS AND LIMITATIONS
WWW::Ohloh::API is very extremely alpha quality. It'll improve, but till then: Caveat emptor.
Please report any bugs or feature requests to bug-www-ohloh-api@rt.cpan.org
, or through the web interface at http://rt.cpan.org.
AUTHOR
Yanick Champoux <yanick@cpan.org>
LICENCE AND COPYRIGHT
Copyright (c) 2008, Yanick Champoux <yanick@cpan.org>
. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.