in reply to Perl API for 32 bit or 64 bit system on Unix
Here's a thought, try
$prog_name = eval("\$\x18"); # $^X $exec_type = `file $prog_name`; if($exec_type =~ /32/) { print "32 bit\n"; } elsif($exec_type =~ /64/) { print "64 bit\n"; } else { print "Cant unpick from $exec_type\n" }
(Untested code)
This would be if you are worried about linking to shared libraries (eg a 32 bit version of Perl won't load a 64 bit shared library under Solaris)
Update: Corrected stupid use of $0 to $^X
|
|---|