- SPEED-UP NOTE
-
If the
freedb_host
isn'tfreedb.freedb.org
and protocol level1
is specified, theconnect
method tries to use the highest available protocol level. To do so, it queries the FreeDB to find out exaclty which level is supported. OnHTTP
connections this takes long. To speed upHTTP
connections specify a higherproto_level
-say5
beforeconnect()
is called.
# Make connection through user agent
my $connection = LWP::UserAgent->new();
defined($connection) ||
throw Error::Simple ("ERROR: InfoSys::FreeDB::Connection::HTTP::connect, Failed to instantiate an \'LWP::UserAgent\' object.");
# Set _connection_
$self->set__connection_($connection);
# Set proxy if required
if ( $self->get_proxy_host() ) {
my $url = 'http://' . $self->get_proxy_host() . ':' .
$self->get_proxy_port();
$connection->proxy ('http', $url);
}
# Return if the protocol level is greater than 1
( $self->get_proto_level() > 1 ) &&
return(undef);
# Return if the freedb_host is "freedb.freedb.org"
( $self->get_freedb_host() eq "freedb.freedb.org" ) &&
return(undef);
# Check the stat
my $stat = $self->stat();
# Disconnect and throw exception if error
if ( $stat->is_error() ) {
$self->set__connection_();
throw Error::Simple("ERROR: InfoSys::FreeDB::Connection::HTTP::connect, handshake failed, stat returned an error.");
}
# Set the highest protocol
$self->set_proto_level( $stat->get_proto_max() );
# Return undef
return(undef);
EOF
},
{
method_name => 'hello',
description => <<EOF,
This method is not supported over C<HTTP>.
EOF
body => <<'EOF',
throw Error::Simple ("ERROR: InfoSys::FreeDB::Connection::HTTP::hello, this method is not supported over 'HTTP'.");
EOF
},
{
method_name => 'proto',
description => <<EOF,
This method is not supported over C<HTTP>.
EOF
body => <<'EOF',
throw Error::Simple ("ERROR: InfoSys::FreeDB::Connection::HTTP::proto, this method is not supported over 'HTTP'.");
EOF
},
{
method_name => 'quit',
body => <<'EOF',
require InfoSys::FreeDB::Response::Quit;
return( InfoSys::FreeDB::Response::Quit->new( {
code => 230,
result => 'OK, goodbye',
hostname => '<this.is.a.dummy.quit.response>',
} ) );
EOF
},
{
method_name => 'update',
description => <<EOF,
THIS METHOD IS NOT YET IMPLEMENTED __SUPER_POD___
EOF
body => <<'EOF',
throw Error::Simple ("ERROR: InfoSys::FreeDB::Connection::HTTP::update, THIS METHOD IS NOT YET IMPLEMENTED.");
EOF
},
{
method_name => 'write',
description => <<EOF,
This method is not supported over C<HTTP>.
EOF
body => <<'EOF',
throw Error::Simple ("ERROR: InfoSys::FreeDB::Connection::HTTP::write, this method is not supported over 'HTTP'.");
EOF
},
],
use_opt => [
{
dependency_name => 'LWP::UserAgent',
},
],
sym_opt => [
],
} );
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 106:
=back doesn't take any parameters, but you said =back EOF body => <<'EOF', my $self = shift;