| WWW-Ohloh-API documentation | Contained in the WWW-Ohloh-API distribution. |
WWW::Ohloh::API::Languages - a set of Ohloh languages
use WWW::Ohloh::API;
use WWW::Ohloh::API::Languages;
my $ohloh = WWW::Ohloh::API( api_key => $key );
my $languages = $ohloh->get_languages( sort => 'code' );
while ( my $l = $languages->next ) {
print $l->nice_name;
}
W::O::A::Languages returns a list of languages known to Ohloh.
The object doesn't retrieve all languages from the Ohloh server in one go, but rather fetch them in small groups as required. If you want to download all languages at the same time, you can use the all() method:
my @langs = $ohloh->get_languages( sort => 'code' )->all;
Creates a new W::O::A::Languages object. It accepts the following arguments:
Mandatory. Its value is the WWW::Ohloh::API object that will be used to query the Ohloh server.
The maximum number of languages the set will contain. If you want to slurp'em all, set it to 'undef' (which is the default).
Returns the retrieved languages' information as WWW::Ohloh::API::Language objects.
Returns the next $n language (or all remaining languages if there are
less than $n), or undef if there is no more languages
to retrieve. After it returned undef, subsequent calls to next will reset
the list. If $n is not given, defaults to 1 entry.
Returns the maximum number of languages the object will return, or undef
if no maximum has been set.
Returns the number of entries selected by the query.
Beware: this number can change during the life of the object! Each time the object retrieves a new batch of entries, this number is updated with the value returned by the Ohloh server, which could differ from its last invication is entries have been added or removed since the last retrieval.
Ohloh API reference: http://www.ohloh.net/api/getting_started
Ohloh Account API reference: http://www.ohloh.net/api/reference/language
This document describes WWW::Ohloh::API version 0.3.1
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.
Yanick Champoux <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.
| WWW-Ohloh-API documentation | Contained in the WWW-Ohloh-API distribution. |
package WWW::Ohloh::API::Languages; use strict; use warnings; use Object::InsideOut qw/ WWW::Ohloh::API::Collection /; use Carp; use XML::LibXML; use Readonly; use List::MoreUtils qw/ any /; use WWW::Ohloh::API::Language; our $VERSION = '0.3.1'; my @ALLOWED_SORTING; Readonly @ALLOWED_SORTING => qw/ total code projects comment_ratio contributors commits name /; sub element { return 'WWW::Ohloh::API::Language' } sub element_name { return 'language' } sub query_path { return 'languages.xml' } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub is_allowed_sort { my $s = shift; return any { $s eq $_ } @ALLOWED_SORTING; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub _init : Init { my $self = shift; return; } #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 'end of WWW::Ohloh::API::Languages'; __END__