MacOSX 10.8 and 32-bit perl modules I just upgraded from MacOSX 10.6 to 10.8.  Many of my projects depend on Mac::Glue, Mac::Carbon and their ilk.  Even though Mac::Glue comes bundled with MacOSX 10.8 perl, it doesn't seem to work:

[kw|~] perl -ce 'use Mac::Glue'
Can't load '/System/Library/Perl/Extras/5.12/darwin-thread-multi-2level/auto/MacPerl/MacPerl.bundle' for module MacPerl: dlopen(/System/Library/Perl/Extras/5.12/darwin-thread-multi-2level/auto/MacPerl/MacPerl.bundle, 1): no suitable image found.  Did find:
    /System/Library/Perl/Extras/5.12/darwin-thread-multi-2level/auto/MacPerl/MacPerl.bundle: mach-o, but wrong architecture at /System/Library/Perl/5.12/darwin-thread-multi-2level/DynaLoader.pm line 204.
 at /System/Library/Perl/Extras/5.12/Mac/Glue/Common.pm line 21
Compilation failed in require at /System/Library/Perl/Extras/5.12/Mac/Glue/Common.pm line 21.
BEGIN failed--compilation aborted at /System/Library/Perl/Extras/5.12/Mac/Glue/Common.pm line 21.
Compilation failed in require at /System/Library/Perl/Extras/5.12/Mac/Glue.pm line 7.
BEGIN failed--compilation aborted at /System/Library/Perl/Extras/5.12/Mac/Glue.pm line 7.
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1.

Mac::Glue is 32-bit:

[kw|~] lipo -info /System/Library/Perl/Extras/5.12/darwin-thread-multi-2level/auto/MacPerl/MacPerl.bundle
Non-fat file: /System/Library/Perl/Extras/5.12/darwin-thread-multi-2level/auto/MacPerl/MacPerl.bundle is architecture: i386


/usr/bin/perl claims to be compatible with that architecture:

[kw|~] file /usr/bin/perl
/usr/bin/perl: Mach-O universal binary with 2 architectures
/usr/bin/perl (for architecture i386):  Mach-O executable i386
/usr/bin/perl (for architecture x86_64):    Mach-O 64-bit executable x86_64

I'm running MacOSX 10.8.2, perl 5.12.4.

Does anyone have any idea how to fix this problem?  If MacOSX is 64-bit, does that prevent perl from being compatible with 32-bit modules, despite its claim to be compatible with two architectures?
I found a solution to the problem: use the MacOSX 'arch' command to force perl to run as 32-bit.  (See also https://stackoverflow.com/questions/2088569/how-do-i-force-python-to-be-32-bit-on-snow-leopard-and-other-32-bit-64-bit-quest .)

[kw|~] arch -32 perl5.12 -ce 'use Mac::Glue'
-e syntax OK


Note that one needs the explicit "perl5.12" and not simply "perl", since (on MacOSX 10.8) /usr/bin/perl is a shell script which delegates to either /usr/bin/perl5.12 or /usr/bin/perl5.10.