Yanick Champoux > WWW-Ohloh-API > WWW::Ohloh::API::Projects

Download:
WWW-Ohloh-API-v0.3.2.tar.gz

Dependencies

Annotate this POD

CPAN RT

Open  1
View/Report Bugs
Module Version: v0.3.2   Source  

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 ) {
        print $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 ) {
        print $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 ^

VERSION ^

This document describes WWW::Ohloh::API version 0.3.2

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.

syntax highlighting: