Peter Pentchev


Net::FreeDB - Perl interface to freedb server(s)


    use Net::FreeDB;
$freedb = Net::FreeDB->new();
$discdata = $freedb->getdiscdata('/dev/cdrom');
my $cddb_file_object = $freedb->read('rock', $discdata->{ID});
print $cddb_file_object->id;


  Net::FreeDB was inspired by Net::CDDB.  And in-fact
    was designed as a replacement in-part by Net::CDDB's
    author Jeremy D. Zawodny.  Net::FreeDB allows an
    oop interface to the freedb server(s) as well as
    some basic cdrom functionality like determining
    disc ids, track offsets, etc.


new(HOST => $h, PORT => $p, USER => $u, HOSTNAME => $hn, TIMEOUT => $to)
        Creates a new Net::FreeDB object.

          Set to username or user-string you'd like to be logged as.

        HOSTNAME: (optional)
          Set to the hostname you'd like to be known as.

        TIMEOUT: (optional)
          Set to the number of seconds to timeout on freedb server.

    new() creates and returns a new Net::FreeDB object that is connected
    to either the given host or as default.
read($cat, $id)

    read($$) takes 2 parameters, the first being a category name.
    This can be any string either that you make up yourself or
    that you believe the disc to be. The second is the disc id. This
    may be generated for the current cd in your drive by calling getdiscid()

    Using an incorrect category will result in either no return or an
    incorrect return. Please check the CDDB::File documentation for
        information on this module.

  read() requests a freedb record for the given information and returns a
    CDDB::File object.
query($id, $num_trks, $trk_offset1, $trk_offset2, $trk_offset3...)

    query($$$...) takes:
  1: a discid
  2: the number of tracks
  3: first track offset
  4: second track offset... etc.

    Query expects $num_trks number of extra params after the first two.

    query() returns an array of hashes. The hashes looks like:

                GENRE  => 'newage',
                DISCID => 'discid',
                ARTIST => 'artist',
                ALBUM  => 'title'

        NOTE: query() can return 'inexact' matches and/or 'multiple exact'
        matches. The returned array is the given returned match(es).

    sites() returns an array reference of urls that can be used as 
    a new HOST.
    getdiscid($) takes the device you want to use.
    Basically this means '/dev/cdrom' or whatever on linux machines
    but it's an array index in the number of cdrom drives on windows
    machines starting at 0. (Sorry, I may change this at a later time).
    So, if you have only 1 cdrom drive then getdiscid(0) would work fine.

  getdiscid() returns the discid of the current disc in the given drive.

    NOTE: See BUGS
    getdiscdata($) takes the device you want to use. See getdiscid()
    for full description.

  getdiscdata() returns a hash of the given disc data as you would
  require for a call to query. The returns hash look like:

     ID => 'd00b3d10',
     NUM_TRKS => '3',
     TRACKS => [
     SECONDS => '2879'

   NOTE: A different return type/design may be developed.


        The current version of getdiscid() and getdiscdata()
        on the Windows platform takes ANY string in a single
        cdrom configuration and works fine.  That is if you
        only have 1 cdrom drive; you can pass in ANY string
        and it will still scan that cdrom drive and return
        the correct data.  If you have more then 1 cdrom drive
        giving the correct drive number will return in an
        accurate return.

AUTHOR David Shultz <> Peter Pentchev <>

CREDITS Jeremy D. Zawodny <> Pete Jordon <>

COPYRIGHT Copyright (c) 2002 David Shultz. Copyright (c) 2005, 2006 Peter Pentchev. All rights reserved. This program is free software; you can redistribute it and/or modify if under the same terms as Perl itself.

2 POD Errors

The following errors were encountered while parsing the POD:

Around line 300:

'=item' outside of any '=over'

Around line 403:

You forgot a '=back' before '=head1'