Skip to content

Instantly share code, notes, and snippets.

@dch
Created February 7, 2011 08:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dch/814128 to your computer and use it in GitHub Desktop.
Save dch/814128 to your computer and use it in GitHub Desktop.
read, push, pull via CouchDB::Client
#!/usr/local/bin/perl
$|=1;
use CouchDB::Client;
#only do this if you need admin logon
#my $c = CouchDB::Client->new(uri => 'http://admin:password@muse.couchone.com:5984/');
my $c = CouchDB::Client->new(uri => 'http://muse.couchone.com:5984/');
$c->testConnection or die "The server cannot be reached";
print "Running version " . $c->serverInfo->{version} . "\n";
#only do this if you're an admin
#my $db = $c->newDB('fatso')->create;
my $db = $c->newDB('fatso');
my $crap = "0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789\n";
my $count = 0;
while (1)
{
print "doc $count\n";
my $doc = $db->newDoc('another_doc_' . $count++, undef, { 'crap' => $crap, 'raccoon' => 'fox' })->create
or die "$!\n$^E\n";
}
exit 0;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment