Net::iTMS::Request - Library for making requests to the iTMS


Net::iTMS::Request handles the fetching, decrypting, and uncompressing of content from the iTunes Music Store.


All methods return undef on error and (should) set an error message, which is available through the error method. (Unless noted otherwise.)

new([ debug => 1, [...] ])

Takes an argument list of key = value> pairs. The options available are:

debug => 0 or 1

If set to a true value, debug messages to be printed to STDERR.

show_xml => 0 or 1

If set to a true value, the XML fetched during each request will printed to STDERR. The debug option must also be set to true for the XML to print.

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

url($url, [$append ,[{ gunzip => 1, decrypt => 0 }]])

This is one of the lower-level methods used internally.

It takes a URL (that should be for the iTMS) as the first argument. If the first argument does NOT start with "http", then it will be taken as a key to the internal hash of URLs ($request->{_url}) and the appropriate stored URL will be used.

The optional second argument is appended to the URL; this is useful pretty much only when the first argument isn't a real URL and you want to append query values to the end of the stored URL.

The optional third argument is a hashref of options. In most cases it is not needed, however, the available options are:

gunzip => 0 or 1

A true value means the (presumably) gzipped content is gunzipped. A false value means it is not.

Default is 1 (unzip content).

decrypt => 0, 1, or 2

A true value other than 2 means the content retrieved from the URL is first decrypted after fetching if it appears to be encrypted (that is, if no initialization vector was passed as a response header for the request). A false value means no decryption is done at all. A value of 2 means decryption will be forced no matter what.

Default is 1 ("intelligent" decrypt), which should work for most, if not all, cases.


Copyright 2004, Thomas R. Sibley.

You may use, modify, and distribute this package under the same terms as Perl itself.


Thomas R. Sibley,


Net::iTMS, XML::Twig