--- trunk/lib/Frey/CouchAPI.pm 2009/05/15 20:43:17 1075 +++ trunk/lib/Frey/CouchAPI.pm 2009/06/29 18:50:27 1116 @@ -91,8 +91,9 @@ } elsif ( $url eq '/_all_dbs' ) { $json = [ map { - s{^\Q$path\E/*}{}; - $_; + my $db = $_; + $db =~ s{^\Q$path\E/*}{}; + $db; } glob $path . $config->{database}->{name_glob} ]; $status = 200; @@ -110,7 +111,7 @@ # poor man's transaction :-) my $code = "\$config->{'$part'} = \$data;"; - eval $code; + eval $code; ## no critic if ( $@ ) { warn "ERROR: $code -> $@"; $status = 500; @@ -207,29 +208,30 @@ my $total_rows = 0; my $collected_rows = 0; - my @docs = grep { length $_ } map { + my @docs = grep { length($_) > 0 } map { ## no critic + my $id = $_; $total_rows++; if ( $limit > 0 && $collected_rows == $limit ) { ''; } else { - - s{^$path/$database/}{}; - if ( defined $endkey && $_ gt $endkey ) { + $id = s{^$path/$database/}{}; + + if ( defined $endkey && $id gt $endkey ) { ''; } elsif ( $startkey ) { - if ( $_ ge $startkey ) { + if ( $id ge $startkey ) { $collected_rows++; - $_; + $id; } else { $offset++; ''; } } else { $collected_rows++; - $_; + $id; } }