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

NAME

Net::iTMS::XML - Methods to process iTMS XML

SYNOPSIS

    use Net::iTMS::XML;

    my $p = Net::iTMS::XML->new(file => 'viewAlbum.xml');
    # or...
    my $p = Net::iTMS::XML->new($string_with_xml);
    
    my @path = @{$p->Path};
    my %tracklist = %{$p->TrackList};
    
    # ...etc...
    # To see the structure...
    use Data::Dumper;
    print Dumper(\%tracklist), "\n";

DESCRIPTION

Net::iTMS::XML creates an XML::Twig object for the provided data. It is then up to you to call the various methods provided and deal with the returned data structures (arrayrefs, hashrefs, and the occasionally string or two).

Currently the structure of the data returned isn't documented (except in code). The easiest way to figure out the structure is to use Data::Dumper or a similar module to print out the structure for you. See the SYNOPSIS for an example.

Methods

All methods (excepting new, purge, and a few others) take the first argument as a hash. Currently the only key in use is cleanup, which determines whether or not the method deletes the branch it's been working on. Default is 1, to delete it (which means undefined results (probably program death) if you call a method that uses an already deleted branch).

new(file => 'viewAlbum.xml')
new($xml)

If the first argument is 'file' (case insensitive), then the second argument is taken to be the name of a file from which to read the XML. If the first argument is anything else, it is taken to be a string of the XML to be parsed.

Returns a blessed hashref (object) for Net::iTMS::XML.

pageType

Returns a string containing the value of the XML document's pageType attribute.

Path

Returns an arrayref of hashrefs containing the name and url of the <Path> elements in the XML.

TrackList

Returns a semi-complex hashref representing the track listing provided in the XML document.

albumsFromSearch

Returns a semi-complex hashref of the albums found from a basic search. Undefined results if called on XML not from a basic search.

album

Returns an hashref of information about the album. Undefined results if called on XML not from a viewAlbum request.

artist

Returns an hashref of information about the artist. Undefined results if called on XML not from a viewArtist request.

artistBiography

Returns an arrayref, each element being a paragraph in the artist's bio. Undefined results if called on XML not from a biography request.

Options

If this option is set, it translates links to albums in the XML into HTML links. The albumId is prepended to the URL passed as the value of the option.

The default is to simply ignore the links, leaving the plain text title.

genericPlist

Processes a generic plist in the XML and returns an arrayref of hashrefs containing the information.

influentialAlbums

Returns an arrayref of hashrefs of information about the influential albums. Undefined results if called on XML not from an influencers request.

purge

Purges the current root twig.

LICENSE

Copyright 2004, Thomas R. Sibley.

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/2.0/ or send a letter to:

    Creative Commons
    559 Nathan Abbott Way
    Stanford, California 94305, USA.

AUTHOR

Thomas R. Sibley, http://zulutango.org:82/

SEE ALSO

Net::iTMS