WWW::Ohloh::API::Projects - a set of Ohloh projects
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 ) { print $p->name; }
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.
get_projects
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.
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.
next()
undef
Examples:
# typical iterator while( my $project = $projects->next ) { print $project->name; } # read projects 10 at a time while( my @p = $project->next( 10 ) ) { # do something with them... }
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.
all()
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;
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 }
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
This document describes WWW::Ohloh::API version 0.2.0
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.
bug-www-ohloh-api@rt.cpan.org
Yanick Champoux <yanick@cpan.org>
<yanick@cpan.org>
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.
To install WWW::Ohloh::API, copy and paste the appropriate command in to your terminal.
cpanm
cpanm WWW::Ohloh::API
CPAN shell
perl -MCPAN -e shell install WWW::Ohloh::API
For more information on module installation, please visit the detailed CPAN module installation guide.