Created
February 7, 2011 08:01
-
-
Save dch/814128 to your computer and use it in GitHub Desktop.
read, push, pull via CouchDB::Client
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/local/bin/perl | |
$|=1; | |
use CouchDB::Client; | |
#only do this if you need admin logon | |
#my $c = CouchDB::Client->new(uri => 'http://admin:[email protected]: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