/[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 1058 by dpavlin, Thu Apr 23 22:18:46 2009 UTC revision 1059 by dpavlin, Fri Apr 24 15:32:04 2009 UTC
# Line 118  warn "json ",dump( $json ), " config ", Line 118  warn "json ",dump( $json ), " config ",
118                          $status = 501;                          $status = 501;
119                  }                  }
120    
         } elsif ( $url =~ m{($regex_dbs)/$} ) {  
   
121  =head2 Database  =head2 Database
122    
123  L<http://wiki.apache.org/couchdb/HTTP_database_API> except compaction  L<http://wiki.apache.org/couchdb/HTTP_database_API> except compaction
124    
125  =cut  =cut
126    
127            } elsif (
128                       $url =~ m{($regex_dbs)/$}
129                    # DELETE doesn't have trailing slash
130                    || $method eq 'DELETE' && $url =~ m{($regex_dbs)$}
131            ) {
132    
133                  my $database = $1;                  my $database = $1;
134    
135                  my $dir = "$path/$database";                  my $dir = "$path/$database";
# Line 157  L<http://wiki.apache.org/couchdb/HTTP_da Line 161  L<http://wiki.apache.org/couchdb/HTTP_da
161                          }                          }
162                  }                  }
163    
164                    warn "## database $database $status ",dump( $json );
165    
166          } elsif ( $url =~ m{($regex_dbs)/([^?]+)\??(.+)?$} ) {          } elsif ( $url =~ m{($regex_dbs)/([^?]+)\??(.+)?$} ) {
167                  my ($database,$id,$args) = ($1,$2,$3);                  my ($database,$id,$args) = ($1,$2,$3);
168    
# Line 260  L<http://wiki.apache.org/couchdb/HTTP_Do Line 266  L<http://wiki.apache.org/couchdb/HTTP_Do
266    
267                  } elsif ( $method eq 'PUT' ) {                  } elsif ( $method eq 'PUT' ) {
268                    
269                          warn "## ",dump( $tx->req ); # if $debug;                          warn "## ",dump( $tx->req ) if $debug;
270    
271                          my $data = $tx->req->content->file->slurp;                          my $data = $tx->req->content->file->slurp;
272    
273                            my $db_path = "$path/$database";
274                            make_path $db_path unless -e $db_path;
275    
276                          Storable::store( from_json($data), $p );                          Storable::store( from_json($data), $p );
277                          my $rev = file_rev $p;                          my $rev = file_rev $p;
278                          warn "store $p $rev size ", -s $p, " bytes | $data\n";                          warn "store $p $rev size ", -s $p, " bytes | $data\n";
# Line 304  L<http://wiki.apache.org/couchdb/HTTP_Do Line 313  L<http://wiki.apache.org/couchdb/HTTP_Do
313                          $status = 501;                          $status = 501;
314                  }                  }
315    
316                  warn "WARNING: arg left from $url = ",dump( $arg ),$/ if keys %$arg;                  if ( keys %$arg ) {
317                            warn "WARNING: arg left from $url = ",dump( $arg ),$/;
318                            $status = 501;
319                    }
320    
321          }          }
322    

Legend:
Removed from v.1058  
changed lines
  Added in v.1059

  ViewVC Help
Powered by ViewVC 1.1.26