NAME

InfoSys::FreeDB - FreeDB connection factory

SYNOPSIS

require InfoSys::FreeDB;
require InfoSys::FreeDB::Entry;

# Read entry from the default CD device
my $entry = InfoSys::FreeDB::Entry->new_from_cdparanoia();

# Create a HTTP connection
my $fact = InfoSys::FreeDB->new();
my $conn = $fact->create_connection( {
    client_name => 'testing-InfoSys::FreeDB',
    client_version => $InfoSys::FreeDB::VERSION,
} );

# Query FreeDB
my $res_q = $conn->query( $entry );
scalar( $res_q->get_match() ) ||
    die 'no matches found for the disck in the default CD-Rom drive';

# Read the first match
my $res_r = $conn->read( ( $res_q->get_match() )[0] );

# Write the entry to STDERR
use IO::Handle;
my $fh = IO::Handle->new_from_fd( fileno(STDERR), 'w' );
$res_r->get_entry()->write_fh( $fh );

ABSTRACT

FreeDB connection factory

DESCRIPTION

InfoSys::FreeDB is the connection factory of the InfoSys::FreeDB module hierarchy. This class creates connections using the protocols supported by FreeDB*.

(*)

Currently CDDBP and HTTP protocols are supported.

CONSTRUCTOR

new()

Creates a new InfoSys::FreeDB object.

METHODS

create_connection(OPT_HASH_REF)

Creates a InfoSys::FreeDB::Connection object. OPT_HASH_REF is a hash reference used to pass connection creation options. On error an exception Error::Simple is thrown.

SPEED-UP NOTE

If protocol level 1 is specified, the connect method tries to use the highest available protocol level. To do so, it queries the FreeDB to find out exaclty which level is supported. On CDDBP connections this doesn't take that long. On HTTP connections it does. To speed up HTTP connections specify a higher proto_level -say 5.

Options for OPT_HASH_REF may include:

auto_connected

Connect the created object just after instantiation. Defaults to 1.

client_host

The hostname of the client. Defaults to &Sys::Hostname::hostname().

client_name

Mandatory option to name the connecting client software.

client_user

The user name of the client. Defaults to scalar( getpwuid($>) ).

client_version

Mandatory option with the client software version string.

freedb_cgi*

The FreeDB cgi to use. Defaults to ~cddb/cddb.cgi.

freedb_host

The FreeDB host. Defaults to freedb.freedb.org.

freedb_port

The port on the FreeDB host. Defaults to 80 for HTTP and to 888 for CDDBP connection types.

protocol

The protocol to use. Either HTTP or CDDBP. Defaults to HTTP.

proto_level

The FreeDB protocol level. Defaults to 1.

proxy_host**

The proxy host to use.

proxy_passwd**

The proxy password to use.

proxy_port**

The port on the proxy host. Defaults to 8080.

proxy_user**

The proxy user name to use.

(*)

Only supported for the HTTP protocol.

(**)

Proxy is only supported for the HTTP protocol.

SEE ALSO

InfoSys::FreeDB::Connection, InfoSys::FreeDB::Connection::CDDBP, InfoSys::FreeDB::Connection::HTTP, InfoSys::FreeDB::Entry, InfoSys::FreeDB::Entry::Track, InfoSys::FreeDB::Match, InfoSys::FreeDB::Response, InfoSys::FreeDB::Response::DiscId, InfoSys::FreeDB::Response::Hello, InfoSys::FreeDB::Response::LsCat, InfoSys::FreeDB::Response::Motd, InfoSys::FreeDB::Response::Proto, InfoSys::FreeDB::Response::Query, InfoSys::FreeDB::Response::Quit, InfoSys::FreeDB::Response::Read, InfoSys::FreeDB::Response::SignOn, InfoSys::FreeDB::Response::Sites, InfoSys::FreeDB::Response::Stat, InfoSys::FreeDB::Response::Ver, InfoSys::FreeDB::Response::Whom, InfoSys::FreeDB::Response::Write::1, InfoSys::FreeDB::Response::Write::2, InfoSys::FreeDB::Site

BUGS

None known (yet.)

TODO

Implement

log()
update()

Test

write()

Analyse

CDDBP through firewall

HISTORY

First development: September 2003 Last update: October 2003

AUTHOR

Vincenzo Zocca

COPYRIGHT

Copyright 2003 by Vincenzo Zocca

LICENSE

This file is part of the InfoSys::FreeDB module hierarchy for Perl by Vincenzo Zocca.

The InfoSys::FreeDB module hierarchy is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

The InfoSys::FreeDB module hierarchy is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with the InfoSys::FreeDB module hierarchy; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA