The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

WebService::Audioscrobbler::User - An object-oriented interface to the Audioscrobbler WebService API

SYNOPSIS

This module implements an object oriented abstraction of an user within the Audioscrobbler database.

    use WebService::Audioscrobbler;

    my $ws = WebService::Audioscrobbler->new;

    # get an object for user named 'foo'
    my $user  = $ws->user('foo');

    # get user's top artists
    my @artists = $user->artists;
    
    # get user's top tags
    my @tags = $user->tags;

    # get user's top tracks
    my @tracks = $user->tracks;
    
    # get user's neighbours
    my @neighbours = $user->neighbours; 

This module inherits from WebService::Audioscrobbler::Base.

FIELDS

name

The name of a given user as provided when constructing the object.

picture_url

URI object pointing to the location of the users's picture, if available.

url

URI object pointing to the location where's additional info might be available about the user.

METHODS

new($user_name, $data_fetcher)

new(\%fields)

Creates a new object using either the given $user_name or the \%fields hashref. The data fetcher object is a mandatory parameter and must be provided either as the second parameter or inside the \%fields hashref.

artists

Retrieves the user's top artists as available on Audioscrobbler's database.

Returns either a list of artists or a reference to an array of artists when called in list context or scalar context, respectively. The artists are returned as WebService::Audioscrobbler::Artist objects by default.

tracks

Retrieves the user's top tracks as available on Audioscrobbler's database.

Returns either a list of tracks or a reference to an array of tracks when called in list context or scalar context, respectively. The tracks are returned as WebService::Audioscrobbler::Track objects by default.

tags

Retrieves the user's top tags as available on Audioscrobbler's database.

Returns either a list of tags or a reference to an array of tags when called in list context or scalar context, respectively. The tags are returned as WebService::Audioscrobbler::Tag objects by default.

neighbours([$filter])

Retrieves musical neighbours from the Audioscrobbler database. $filter can be used as a constraint for neighbours with a low similarity index (ie. users which have a similarity index lower than $filter won't be returned).

Returns either a list of users or a reference to an array of users when called in list context or scalar context, respectively. The users are returned as WebService::Audioscrobbler::SimilarUser objects by default.

friends

Retrieves the user's friends from the Audioscrobbler / LastFM database.

Returns either a list of users or a reference to an array of users when called in list context or scalar context, respectively. The users are returned as WebService::Audioscrobbler::User objects by default.

fetch_users($postfix, $callback)

Internal method used to fetch users. $postfix should be the users data feed postfix and $callback should be a function reference which will be called with a arrayref of user data as the only parameter and should return user-derived objects.

It returns either an arrayref or a list of objects depending on the calling context.

resource_path

Returns the URL from which other URLs used for fetching user info will be derived from.

AUTHOR

Nilson Santos Figueiredo Junior, <nilsonsfj at cpan.org>

COPYRIGHT & LICENSE

Copyright 2006-2007 Nilson Santos Figueiredo Junior, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.