WWW::Ohloh::API - Ohloh API implementation


    use WWW::Ohloh::API;

    my $ohloh = WWW::Ohloh::API->new( api_key => $my_api_key );
    my $account $ohloh->get_account( id => 12933 );

    print $account->name;


This module is a Perl interface to the Ohloh API as defined at


new( [ api_key => $api_key ] )

Create a new WWW::Ohloh::API object. To be able to retrieve information from the Ohloh server, an api key must be either passed to the constructor or set via the set_api_key method.

    my $ohloh = WWW::Ohloh::API->new( api_key => $your_key );

get_account( [ id | email ] => $account_id )

Return the account associated with the $account_id as a WWW::Ohloh::API::Account object. If no such account exists, an error is thrown. The $accound_id can either be specified as the Ohloh id number, or the email address associated with the account.

    my $account = $ohloh->get_account( id => 12933 );
    my $other_accound = $ohloh->get_account( email => '' );

get_project( $id )

Return the project having the Ohloh id $id as a WWW::Ohloh::API::Project. If no such project exists, an error is thrown.

    my $project = $ohloh->get_project( 1234) ;
    print $project->name;

get_projects( query => $query, sort => $sorting_order, max => $nbr )

Return a set of projects as a WWW::Ohloh::API::Projects object.



If provided, only the projects matching the query string are returned. A project matches the query string is any of its name, description or tags does.


If provided, the projects will be returned according to the specified sorting order. Valid values are 'created_at', 'description', 'id', 'name', 'stack_count', 'updated_at', 'created_at_reverse', 'description_reverse', 'id_reverse', 'name_reverse', 'stack_count_reverse' or 'updated_at_reverse'. If no sorting order is explicitly given, 'id' is the default.


If given, the project set will returns at most $nbr projects.

    # get top ten stacked projects
    my @top = $ohloh->get_projects( max => 10, sort => 'stack_count' )->all;

get_languages( sort => $order )

Return the languages known to Ohloh a set of WWW::Ohloh::API::Language objects.

An optional sort parameter can be passed to the method. The valid $orders it accepts are total, code, projects, comment_ratio, contributors, commits and name. If sort is not explicitly called, projects are returned in alphabetical order of names.

get_activity_facts( $project_id, $analysis )

Return a set of activity facts computed out of the project associated with the $project_id as a WWW::Ohloh::API::ActivityFacts object.

The optional argument $analysis can be either an Ohloh analysis id (which must be an analysis associated to the project) or the keyword 'latest'. By default the latest analysis will be queried.

get_contributor_language_facts( project_id => $p_id, contributor_id => $c_id )

    my @facts = $ohloh->get_contributor_language_facts(
        project_id     => 1234,
        contributor_id => 5678

Return the list of contributor language facts associated to the contributor $c_id for the project $p_id.

get_enlistments( project_id => $id )

Returns the list of enlistements pertaining to the given project as an WWW::Ohloh::API::Enlistment object.

    my $enlistments = $ohloh->get_enlistments( project_id => 1234 );

    while ( my $enlistment = $enlistments->next ) {
        # do stuff with $enlistment...

get_size_facts( $project_id, $analysis_id )

Return the list of WWW::Ohloh::API::SizeFact objects pertaining to the given project and analysis. If $analysis_id is not provided, it defaults to the latest analysis done on the project.

get_project_stacks( $project_id )

Return the list of stacks containing the project as WWW::Ohloh::API::Stack objects.

get_account_stack( $account_id )

Return the stack associated with the account as an WWW::Ohloh::API::Stack object.

fetch_messages( [ account | project ] => $id )

Returns the messages associated to the given account or project as a WWW::Ohloh::API::Messages object.



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


WWW::Ohloh::API is very extremely alpha quality. It'll improve, but till then: Caveat emptor.

Please report any bugs or feature requests to, or through the web interface at


Yanick Champoux <>


Copyright (c) 2008, Yanick Champoux <>. 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.