The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

App::LastStats - A module to fetch and display Last.fm statistics

SYNOPSIS

  use App::LastStats;

  my $stats = App::LastStats->new(
    username   => 'davorg',
    period     => '7day',
    format     => 'text',
    count      => 10,
    api_key    => 'your_api_key',
    api_secret => 'your_api_secret',
  );

  $stats->run;

DESCRIPTION

App::LastStats is a module that fetches and displays Last.fm statistics for a given user. It allows you to specify the time period, format, and number of artists to display.

METHODS

run

Fetches and displays the Last.fm statistics based on the provided options.

validate

Validates the provided options.

render_text

Renders the statistics in plain text format.

render_json

Renders the statistics in JSON format.

render_html

Renders the statistics in HTML format.

render

Renders the statistics using the specified format.

laststats

Fetches the Last.fm statistics for the specified user and time period.

API

You will need an API key and secret in order to use this program. You can get these from https://www.last.fm/api/account/create.

The API key and secret can be passed as arguments to the constructor (as in the sample code above). Alternatively, they can be read from environment variables called LASTFM_API_KEY and LASTFM_API_SECRET.

AUTHOR

Dave Cross <dave@perlhacks.com>

LICENSE

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