Many apologies... have corrected with the CODE tags...
I'm having problems with a hash problem and am getting the response - "Can't use an undefined value as a HASH reference at line 49" from my procedure.
I am accessing a Notes database (holds telephone directory information) with this procedure included below. The commented out section (used against my mailbox) works fine - but the second section (used against the telephone directory database) gives the error...
If anyone has any hints/can give any help i would be grateful! Thanks, Lewis Bishop
use strict;
use Win32::OLE;
use Data::Dumper;
my %count;
my $Buffer;
my $Document;
my $DocCount;
my $FullName;
my $Extension;
my $cnt = 1;
my $Notes = Win32::OLE->new('Notes.NotesSession') or die "Cannot start
+ Lotus Notes Session object.\n";
my ($Version) = ($Notes->{NotesVersion} =~ /\s*(.*\S)\s*$/);
print "The current user is $Notes->{UserName}.\n";
print "Running Notes \"$Version\" on \"$Notes->{Platform}\".\n";
$cnt = 0;
#------------------this section does work correctly-------------------
+----------
#my $Database = $Notes->GetDatabase('GBLOSPK01', 'mail\\lbishop.nsf');
#my $AllDocuments = $Database->AllDocuments;
#my $Count = $AllDocuments->Count;
#print "There are $DocCount documents in the database.\n";
#for (my $Index = 1 ; $Index <= $Count ; ++$Index) {
# my $Document = $AllDocuments->GetNthDocument($Index);
# $Subject = $Document->GetFirstItem('Subject')->{Text};
# $From = $Document->GetFirstItem('From')->{Text};
# #$Body = $Document->Body();
# if (index($From,"CN=") > -1) {
# $From = substr($From,3);
# if (index($From,"/OU=") > -1) {
# $From = substr($From,0,index($From,"/OU="));
# }
# }
# if ($Index < 415) {
# print "$Index - From: $From - Subject: $Subject\n";
# #print "BODY: $Body\n";
# }
#}
#------------------this section does not work correctly---------------
+--------------
my $Database = $Notes->GetDatabase('GBLOSPK02', 'iddnames.nsf');
my $AllDocuments = $Database->AllDocuments;
my $Count = $AllDocuments->Count;
print "There are $DocCount documents in the database.\n";
for (my $Index = 1 ; $Index <= $Count ; ++$Index) {
my $Document = $AllDocuments->GetNthDocument($Index);
$FullName = $Document->GetFirstItem('FullName')->{Text};
$Extension = $Document->GetFirstItem('Extension')->{Text};
if ($Index < 145) {
print "$FullName - $Extension\n";
}
}