/[couchdb]/bin/couchdb-admin.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /bin/couchdb-admin.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 17 - (show annotations)
Sun Aug 31 00:06:49 2008 UTC (14 years, 3 months ago) by dpavlin
File MIME type: text/plain
File size: 856 byte(s)
simple command-line admin for CouchDB
1 #!/usr/bin/perl
2
3 use warnings;
4 use strict;
5
6 use CouchDB::Client;
7 use Getopt::Long;
8 use Data::Dump qw/dump/;
9
10 my $uri = 'http://localhost:5984/';
11
12 my ( $list, @delete, @dump ) = ( 1 );
13
14 GetOptions(
15 'uri=s' => \$uri,
16 'list!' => \$list,
17 'delete|drop=s@' => \@delete,
18 'dump=s@' => \@dump,
19 ) or die "$0: $!";
20
21 my $c = CouchDB::Client->new( uri => $uri );
22 $c->testConnection or die "The server cannot be reached";
23 warn "# $uri ",dump( $c->serverInfo ),"\n";
24
25 $c->req( 'DELETE', "/$_" ) foreach @delete;
26
27 foreach my $dump ( @dump ) {
28 warn "## dump $dump\n";
29 die "$dump doesn't exist\n" unless $c->dbExists( $dump );
30 my $db = $c->newDB( $dump );
31 foreach ( @{ $db->listDocIdRevs } ) {
32 warn "DOC = ",dump( $_ );
33 my $doc = $db->newDoc( $_->{id}, $_->{rev} );
34 $doc->retrieve;
35 warn dump( $doc );
36 }
37 }
38
39 print join("\n", @{ $c->listDBNames } ) if $list;

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26