/[Frey]/trunk/lib/Frey/CouchAPI.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/lib/Frey/CouchAPI.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1061 by dpavlin, Fri Apr 24 21:51:03 2009 UTC revision 1071 by dpavlin, Tue Apr 28 16:38:18 2009 UTC
# Line 4  package Frey::CouchAPI; Line 4  package Frey::CouchAPI;
4    
5  This is REST wrapper using following L<Mojo> implement Apache's CouchDB API  This is REST wrapper using following L<Mojo> implement Apache's CouchDB API
6    
7    You can access it using normal C</_utils/> URI, just like on real CouchDB and
8    it will bring up partially functional Futon interface against this module.
9    
10  L<Mojo::URL>  L<Mojo::URL>
11    
# Line 198  L<http://wiki.apache.org/couchdb/HTTP_Do Line 200  L<http://wiki.apache.org/couchdb/HTTP_Do
200                          my $by = $1;                          my $by = $1;
201                          my $offset = 0;                          my $offset = 0;
202                          my $startkey = delete $arg->{startkey};                          my $startkey = delete $arg->{startkey};
203                               $startkey ||= delete $arg->{startkey_docid}; # XXX key == id
204                          my $endkey   = delete $arg->{endkey};                          my $endkey   = delete $arg->{endkey};
205                          my $limit    = delete $arg->{limit};                          my $limit    = delete $arg->{limit};
206                          my $skip     = delete $arg->{skip};                          my $skip     = delete $arg->{skip};
207                          my $total_rows = 0;                          my $total_rows = 0;
208                            my $collected_rows = 0;
209    
210                          my @docs = grep { length $_ } map {                          my @docs = grep { length $_ } map {
211    
212                                  if ( $limit > 0 && $total_rows == $limit ) {                                  $total_rows++;
213            
214                                    if ( $limit > 0 && $collected_rows == $limit ) {
215                                          '';                                          '';
216                                  } else {                                  } else {
217                    
# Line 215  L<http://wiki.apache.org/couchdb/HTTP_Do Line 221  L<http://wiki.apache.org/couchdb/HTTP_Do
221                                                  '';                                                  '';
222                                          } elsif ( $startkey ) {                                          } elsif ( $startkey ) {
223                                                  if ( $_ ge $startkey ) {                                                  if ( $_ ge $startkey ) {
224                                                          $total_rows++;                                                          $collected_rows++;
225                                                          $_;                                                          $_;
226                                                  } else {                                                  } else {
227                                                          $offset++;                                                          $offset++;
228                                                          '';                                                          '';
229                                                  }                                                  }
230                                          } else {                                          } else {
231                                                  $total_rows++;                                                  $collected_rows++;
232                                                  $_;                                                  $_;
233                                          }                                          }
234                                  }                                  }

Legend:
Removed from v.1061  
changed lines
  Added in v.1071

  ViewVC Help
Powered by ViewVC 1.1.26