Subject: | couchdb() defunct if using trailing backslash |
If using
my $couch = couchdb('http://some.host:7777/my_database');
subsequent calls fails because the uri attribute has been mangled.
This is caused by the following code:
sub couchdb {
my $db = shift;
if ($db =~ /^http:/) {
my $uri = URI->new($db);
my $name = basename($db);
$uri .= '/' if ($uri !~ /\/$/);
^^^ HERE
AnyEvent::CouchDB::Database->new($name, $uri);
} else {
AnyEvent::CouchDB->new->db($db);
}
}
A patch has been included.
Subject: | couch.patch |
*** CouchDB.pm-old 2010-02-25 22:22:08.000000000 +0100
--- /usr/local/share/perl/5.10.0/AnyEvent/CouchDB.pm 2010-02-25 22:16:57.000000000 +0100
***************
*** 60,68 ****
sub couchdb {
my $db = shift;
if ($db =~ /^http:/) {
my $uri = URI->new($db);
my $name = basename($db);
- $uri .= '/' if ($uri !~ /\/$/);
AnyEvent::CouchDB::Database->new($name, $uri);
} else {
AnyEvent::CouchDB->new->db($db);
--- 60,68 ----
sub couchdb {
my $db = shift;
if ($db =~ /^http:/) {
+ $db .= '/' if ($db !~ /\/$/);
my $uri = URI->new($db);
my $name = basename($db);
AnyEvent::CouchDB::Database->new($name, $uri);
} else {
AnyEvent::CouchDB->new->db($db);