91 |
} elsif ( $url eq '/_all_dbs' ) { |
} elsif ( $url eq '/_all_dbs' ) { |
92 |
$json = [ |
$json = [ |
93 |
map { |
map { |
94 |
s{^\Q$path\E/*}{}; |
my $db = $_; |
95 |
$_; |
$db =~ s{^\Q$path\E/*}{}; |
96 |
|
$db; |
97 |
} glob $path . $config->{database}->{name_glob} |
} glob $path . $config->{database}->{name_glob} |
98 |
]; |
]; |
99 |
$status = 200; |
$status = 200; |
111 |
|
|
112 |
# poor man's transaction :-) |
# poor man's transaction :-) |
113 |
my $code = "\$config->{'$part'} = \$data;"; |
my $code = "\$config->{'$part'} = \$data;"; |
114 |
eval $code; |
eval $code; ## no critic |
115 |
if ( $@ ) { |
if ( $@ ) { |
116 |
warn "ERROR: $code -> $@"; |
warn "ERROR: $code -> $@"; |
117 |
$status = 500; |
$status = 500; |
208 |
my $total_rows = 0; |
my $total_rows = 0; |
209 |
my $collected_rows = 0; |
my $collected_rows = 0; |
210 |
|
|
211 |
my @docs = grep { length $_ } map { |
my @docs = grep { length($_) > 0 } map { ## no critic |
212 |
|
|
213 |
|
my $id = $_; |
214 |
$total_rows++; |
$total_rows++; |
215 |
|
|
216 |
if ( $limit > 0 && $collected_rows == $limit ) { |
if ( $limit > 0 && $collected_rows == $limit ) { |
217 |
''; |
''; |
218 |
} else { |
} else { |
|
|
|
|
s{^$path/$database/}{}; |
|
219 |
|
|
220 |
if ( defined $endkey && $_ gt $endkey ) { |
$id = s{^$path/$database/}{}; |
221 |
|
|
222 |
|
if ( defined $endkey && $id gt $endkey ) { |
223 |
''; |
''; |
224 |
} elsif ( $startkey ) { |
} elsif ( $startkey ) { |
225 |
if ( $_ ge $startkey ) { |
if ( $id ge $startkey ) { |
226 |
$collected_rows++; |
$collected_rows++; |
227 |
$_; |
$id; |
228 |
} else { |
} else { |
229 |
$offset++; |
$offset++; |
230 |
''; |
''; |
231 |
} |
} |
232 |
} else { |
} else { |
233 |
$collected_rows++; |
$collected_rows++; |
234 |
$_; |
$id; |
235 |
} |
} |
236 |
} |
} |
237 |
|
|