Friday, October 1, 2010

Retrieving Notes data from Perl


By Joe Dolittle

A few weeks ago, we answered a reader's question about how to use Domino with PHP. That got me thinking: what about Perl?

Now, to be clear, I'm actually not half bad with PHP, but Perl is still a dark art to me. I've written Perl code, but most of it involved cutting and pasting chunks, swearing a lot, searching online, declaring I'd never touch it again, and searching online once again, only to have some smart-ass kid answer a forum query with something like "Dood, you need to swap the * and the ?. Dork."

Like I said, Perl has never really been kind to me.

Even so, I wondered if there was an easy way for Perl scripts to access Notes databases and it turns out, it's almost astonishingly easy, using some basic OLE calls.

I found a post by dlandgren (I do so wish people would put their real names on things), where he shows a a simple script that does just that.

He first tells Perl to use Win32 OLE. Then he creates a new Notes sessions, opens the Notes database, and, in his case, retrieves a pointer to all the documents.

The code is pretty straightforward, but it's also important you read the comments to his post, because there are some added clues there as well.

Now you can Notes one and Perl, too!