I’ve been working away on a project where I’ll be using CouchDB and Perl, and was searching the ‘net for information on CouchDB CPAN modules.
There were, of course a lot of CouchDB modules that turned up on MetaCPAN, however I couldn’t figure out which one I should bother messing around with. I was looking for something simple and straight-forward, similar to the module that was posted in full-source format on Apache CouchDB’s “Getting Started with Perl” guide.
I looked at CouchDB::Client, but found the implementation a little scattered – there are no functions documented that explain how to deal with couchdb documents, only for getting info on and creating databases (the tests in ‘t/’ weren’t very helpful here either). And the functions don’t say anything about document id’s, which would have been nice.
I also looked at AnyEvent::CouchDB, but again there seemed to be too much going on.. too many methods for doing many things that I won’t need to do.
The “Getting Started with Perl” guide talks about a module called Net::CouchDB, a module that is curiously missing from CPAN as far as MetaCPAN and search.cpan.org are concerned – but Jeremy Zawodny wrote up a nice guide called “Hacking with CouchDB” that uses this module, showing it’s clear interfaces with function names like:
- $cdb->put, and
These are of course in contrast to confusing function names like:
- $cdb->couch(), or
.. that you’d have to deal with in AnyEvent::CouchDB.
Eventually MetaCPAN lead me to “CouchDB::Simple” which sounded a lot more like what I was looking for. I didn’t get very far with it however, since the install failed. I e-mailed the author to give him a heads up, since I don’t think it was my environment at fault (perlbrew perl 5.14.2 + cpanm). I’ll give it another try this week and see if I can get through that hurdle.
Update (2012-01-25): Gave AnyEvent::CouchDB a try, things didn’t go as smoothly as I was hoping. I can attribute some of this struggle to my lack of familiarity with CouchDB. Also gave DB::CouchDB a try and got a lot further, but ran into a problem with “bad_content_type” error messages when attempting to post a document to the database. A little reading and I found that this error can easily be triggered by JSON syntax errors.. but isn’t that what the module is supposed to handle? I’m thinking I may now give this a try with WWW::Curl or some such, since I’m not having too much luck with CouchDB specific modules… but I’m not done yet :)