en · de

Domino - sticking Worlds together with Perl

by Thomas,
assono GmbH, Standort Kiel,


When talking about Perl and Domino most people (at least those who know both) probably think about OLE automation, but there are other ways to work with it.

By using the "Inline::Java" Perl module it is possible to access the Domino/Java bindings in a Perl script - a good combo which combines the strengths of both Perl and Java.

Perl is very useful, especially when you need a small tool, fast - of course it's still Java which does the whole work, but there is no need to write a single line of java code to use it.


The following Perl script lists all databases in the domino server's database directory, it also gives a few short information of the database (like replica id, title and filename)

1 #! /usr/bin/perl


2


3
use strict;


4
use warnings;


5
use Inline (


6
Java => 'STUDY',


7
CLASSPATH => 'NCSO.jar', # NCSO.jar des domino servers



muß im classpath stehen



8
STUDY => ['lotus.domino.NotesFactory'],


9
AUTOSTUDY => 1


10
);


11


12


13
my $session;


14
my $dbdirectory;


15
my $database;


16


17
eval{


18
$session = lotus::domino::NotesFactory->createSession("servername", "user", "password");


19
$dbdirectory
= $session->getDbDirectory("");


20


21
##


22
# kleiner stolperstein in der funktion "getFirstDatabase" :


23
# "datenbanken suchen" muß im serverdokument für http-clients aktiviert werden:


24
#


25
# http://ianconnor.blogspot.com/2007/07/diiop-notesexception-server-access.html


26
#


27
$database
= $dbdirectory->getFirstDatabase($dbdirectory->{DATABASE});


28
};


29
# prüfen ob eine exception geworfen wurde


30
if($@){


31
die($@->toString()) if(ref($@)); # fehler in java


32
die($@); # oder in perl


33
}


34
# informationen für alle datenbanken im dbdirectory ausgeben


35
while(ref($database)){


36
eval{


37
print "[".$database->getReplicaID()."] : "


.
$database->getTitle()." -> "


.
$database->getFilePath()."\n";


38
$database = $dbdirectory->getNextDatabase();


39
};


40
if($@){


41
warn($@->toString()) if(ref($@));


42
die($@);


43
}


44
}


45

46
# am schluß noch aufräumen


47
$dbdirectory->recycle();


48
$session->recycle();





Links:

http://strawberryperl.com/

http://search.cpan.org/~patl/Inline-Java-0.52/

Technical article IBM Domino JavaScript Java Development

You have questions about this article? Contact us: blog@assono.de

Sie wollen eine individuelle Beratung oder einen Workshop? Read more

More interesting entries

Any questions? Contact us.

If you want to know more about our offers, you can contact us at any time. There are several ways to contact us for a non-binding first consultation.

assono GmbH

Location Kiel (headquarters)
assono GmbH
Lise-Meitner-Straße 1–7
24223 Schwentinental

Location Hamburg
assono GmbH
Bornkampsweg 58
22761 Hamburg

Phone numbers:
Human resources department: +49 4307 900 407
Marketing department: +49 4307 900 411

E-Mail adresses:
contact@assono.de
bewerbung@assono.de