in reply to Re: Retrieving content from couchdb using CouchDB::Client
in thread Retrieving content from couchdb using CouchDB::Client

CouchDB::Client::Doc=HASH(0x240e8e8)

This is what i get in return, my point is that i created a document and then i am able to get it since $doc object is present but if the doc is present already in couchdb and i want to retrieve it then what should be the procedure. If i run the same code again then doc is already present in couchdb so i get this as output.

hello

Can't call method "retrieve" on an undefined value at couch.pl line 15.

  • Comment on Re^2: Retrieving content from couchdb using CouchDB::Client

Replies are listed 'Best First'.
Re^3: Retrieving content from couchdb using CouchDB::Client
by GotToBTru (Prior) on Apr 23, 2015 at 16:00 UTC

    Perhaps apply the retrieve method to the $db object?

    if ($db->docExists('12345')) { print "hello\n"; $doc = $db->retrieve('12345'); } else { $doc = $db->newDoc('12345', undef, {'foo'=>'bar'})->create; }
    Dum Spiro Spero

      get the same result as previously

      hello

      Can't call method "retrieve" on an undefined value at couch.pl line 11.