<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"\@SimSun";
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"Trebuchet MS";
panose-1:2 11 6 3 2 2 2 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Calibri","sans-serif";
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>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. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Sample code:<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>use Mail::Outlook;<o:p></o:p></p><p class=MsoNormal>use Win32::OLE::Const 'Microsoft Outlook';<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal># create an instance of Outlook<o:p></o:p></p><p class=MsoNormal>print "Attempting to create Outlook object......";<o:p></o:p></p><p class=MsoNormal>my $outlook;<o:p></o:p></p><p class=MsoNormal>die "Whoops! $!\n" unless $outlook = new Mail::Outlook();<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>print "\nOpening the Inbox......";<o:p></o:p></p><p class=MsoNormal>my $folder = $outlook->folder('Inbox') || die "Unable to open folder Inbox.. $!\n";<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal># get the first message in the folder<o:p></o:p></p><p class=MsoNormal>print "\nReading first message......";<o:p></o:p></p><p class=MsoNormal>my $message = $folder->first() || die "Unable to get to first message in the inbox\n";<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>print "\nMessages:\n";<o:p></o:p></p><p class=MsoNormal>while ($message)<o:p></o:p></p><p class=MsoNormal>{<o:p></o:p></p><p class=MsoNormal> print "From: ", $message->From(),"\n";<o:p></o:p></p><p class=MsoNormal> <span lang=FR>print "Subject: ", $message->Subject(),"\n\n";<o:p></o:p></span></p><p class=MsoNormal><span lang=FR> <o:p></o:p></span></p><p class=MsoNormal><span lang=FR> </span>$message = $folder->next();<o:p></o:p></p><p class=MsoNormal>}<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Under x86 Windows, I get the expected output (a list of items from my Inbox) but under x64 Windows I get…<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>C:\Projects>perl test3.pl<o:p></o:p></p><p class=MsoNormal>Loading Mail::Outlook<o:p></o:p></p><p class=MsoNormal>Loading Win32::OLE::Const<o:p></o:p></p><p class=MsoNormal>Whoops!<o:p></o:p></p><p class=MsoNormal>Attempting to create Outlook object......<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>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?<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Trebuchet MS","sans-serif";color:#444444'>John Warner<o:p></o:p></span></b></p><p class=MsoNormal><b><span style='font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#0085C3'>Dell</span></b><span style='font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#444444'> | </span><span style='font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:black'>Systems Management Software Lab</span><span style='font-size:10.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D'> </span><span style='font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#444444'><o:p></o:p></span></p><p class=MsoNormal><b><span style='font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#444444'>office</span></b><span style='font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#444444'> +1 512 723 2793, 800 945 3355 ext 7232793<b><o:p></o:p></b></span></p><p class=MsoNormal><a href="mailto:john_warner@dell.com"><span lang=FR style='font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:blue'>john_warner@dell.com</span></a><b><span lang=FR style='font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#444444'><o:p></o:p></span></b></p><p class=MsoNormal><span lang=FR style='font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#444444'>Dell Inc. </span><span style='font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#444444'>One Dell Way, MS RR5-P170, Round Rock, TX 78682<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#444444'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#444444'>Office Hours: </span><b><span style='font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:red'>Tuesday - Friday 7:00 am - 5:00 pm CDT</span></b><span style='font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#444444'><o:p></o:p></span></p><p class=MsoNormal><span style='font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:#1F497D'><br></span><span style='font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:black'>How am I doing? Email my manager Leah Spence at </span><a href="mailto:Leah_Spence@dell.com"><span style='font-size:8.0pt;font-family:"Trebuchet MS","sans-serif";color:blue'>Leah_Spence@dell.com</span></a><span style='color:#1F497D'><o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>