WebService::BBC::MusicCharts - Retrieve and return UK music chart listings


WebService-BBC-MusicCharts documentation  | view source Contained in the WebService-BBC-MusicCharts distribution.

Index


NAME

Top

WebService::BBC::MusicCharts - Retrieve and return UK music chart listings

SYNOPSIS

Top

  use WebService::BBC::MusicCharts;

  my $chart = WebService::BBC::MusicCharts->new( chart => 'album' );
  my $count = 1;

  foreach my $title ($chart->titles) {
    print "At $count we have $title\n";
    $count++;
  }

DESCRIPTION

Top

The WebService::BBC::MusicCharts module provides access to some of the BBCs online music charts via a simple object-oriented interface.

It currently supports the singles chart, album chart and downloaded music charts.

EXAMPLES

Top

  use WebService::BBC::MusicCharts;

  my $albums = WebService::BBC::MusicCharts->new( chart => 'album' );

  foreach my $chart_position (1..40) {
    my $details = $albums->number($chart_position);
    print "$chart_position: ", $details->{title};
    print " by ", $details->{artist},"\n";
  }

METHODS

Top

new ( chart => 'chart type' )

This is the constructor for a new WebService::BBC::MusicCharts object. The chart argument is required (and can currently be 'album', 'download' or 'singles') and the module will die if it is either missing or passed an invalid value.

The constructor also does the actual page fetch, which may also die if the get fails. Wrapping the new invocation in an eval isn't a bad idea.

chart_type

Returns the type of chart that this instance represents. Mostly used when I was debugging the module.

titles

Returns an array containing all the titles from the chart this instance represents.

artists

Returns an array containing all the artists from the chart this instance represents.

number($num)

The number method must be called with a valid integer (it accepts any between 1 and 40), it then returns a hash ref containing the details for the song/album at that chart position.

The fields returned are:artist - the name of the artisttitle - the title of the single or albumlabel - the owning record labelthis_week - the current chart position of the song/albumlast_week - The position this song/album was at last week. This will either be a number, NEW or RE (re-entry)weeks_in_chart - the number of weeks it's been in the chart

If called without an argument, or with one that's not between 1 and 40, it will return undef.

DEPENDENCIES

Top

WebService::BBC::MusicCharts requires the following modules:

LWP::Simple

Template::Extract

LICENCE AND COPYRIGHT

Top

AUTHOR

Top

Dean Wilson <dean.wilson@gmail.com>


WebService-BBC-MusicCharts documentation  | view source Contained in the WebService-BBC-MusicCharts distribution.