APM: x64 Strawberry Perl 5.12.3 and OLE
John_Warner at Dell.com
John_Warner at Dell.com
Wed Oct 5 07:46:38 PDT 2011
After a looong absence from programming, I find myself with the need to automate some tasks that I'd like to use Perl to solve. I've run into an oddity that I don't know how to work around. The following code works on x86 Windows 7 with ActiveState Perl 5.10.1 but not on x64 Windows 7 with either ActiveState or Strawberry Perl. I think there is something different about OLE under x64 Windows that is broken in Perl.
Sample code:
use Mail::Outlook;
use Win32::OLE::Const 'Microsoft Outlook';
# create an instance of Outlook
print "Attempting to create Outlook object......";
my $outlook;
die "Whoops! $!\n" unless $outlook = new Mail::Outlook();
print "\nOpening the Inbox......";
my $folder = $outlook->folder('Inbox') || die "Unable to open folder Inbox.. $!\n";
# get the first message in the folder
print "\nReading first message......";
my $message = $folder->first() || die "Unable to get to first message in the inbox\n";
print "\nMessages:\n";
while ($message)
{
print "From: ", $message->From(),"\n";
print "Subject: ", $message->Subject(),"\n\n";
$message = $folder->next();
}
Under x86 Windows, I get the expected output (a list of items from my Inbox) but under x64 Windows I get...
C:\Projects>perl test3.pl
Loading Mail::Outlook
Loading Win32::OLE::Const
Whoops!
Attempting to create Outlook object......
This is puzzling because it prints out the failure message (Whoops!) before the attempting message. Has anybody else encountered this? Is there a work around? Should I be using something other than OLE?
John Warner
Dell | Systems Management Software Lab
office +1 512 723 2793, 800 945 3355 ext 7232793
john_warner at dell.com<mailto:john_warner at dell.com>
Dell Inc. One Dell Way, MS RR5-P170, Round Rock, TX 78682
Office Hours: Tuesday - Friday 7:00 am - 5:00 pm CDT
How am I doing? Email my manager Leah Spence at Leah_Spence at dell.com<mailto:Leah_Spence at dell.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/austin/attachments/20111005/d8de2079/attachment.html>
More information about the Austin
mailing list