APM: x64 Strawberry Perl 5.12.3 and OLE
John_Warner at Dell.com
John_Warner at Dell.com
Wed Oct 5 12:33:57 PDT 2011
I did find these articles but since I'm not getting any error message, I wasn't sure if the first article applied to me. I can try a 32-bit Perl again now that I know there are two different versions of command prompt on x64 Windows. Through pure happenstance (ok, user error), I installed 32-bit Perl on my x64 Win7 system which didn't work at all from a regular (aka 64-bit) command prompt. Eventually, I was able to determine that I needed a 32-bit command prompt but the symptoms did not change with the 64-bit version of Perl installed or using wperl. It is the 32-bit shell that provided the output in my question. I will try installing a 32-bit version of Perl and see if the results change.
I've never had to right a wrapper before. How hard is it? Any guidance on where I should go to educate myself and any pointers/tips would be appreciated.
Thanks!
From: Montgomery Conner [mailto:montgomery.conner at gmail.com]
Sent: Wednesday, October 05, 2011 1:56 PM
To: Warner, John
Subject: Re: APM: x64 Strawberry Perl 5.12.3 and OLE
It seems that your issue stems from using Win32::OLE with a version of Perl that may have been compiled for 64 bit address space. It seems that on the Windows platform a 64 bit process (perl in this case) will not have correct access to the 32 bit address space of the underlying Win32::OLE DLL.
Can you use a 32 bit Perl on the problem systems?
Google reveals enlightenment from the perlmonks, here:
http://www.perlmonks.org/?node_id=824725
http://www.perlmonks.org/?node_id=825142
Hope that helps,
Montgomery
On Wed, Oct 5, 2011 at 9:46 AM, <John_Warner at dell.com<mailto:John_Warner at dell.com>> wrote:
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<http://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<tel:%2B1%20512%20723%202793>, 800 945 3355 ext 7232793<tel:800%20945%203355%20ext%207232793>
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>
_______________________________________________
Austin mailing list
Austin at pm.org<mailto:Austin at pm.org>
http://mail.pm.org/mailman/listinfo/austin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/austin/attachments/20111005/540ce1c1/attachment.html>
More information about the Austin
mailing list