Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Tell if arch is HP or HPIA64

by tmurnane (Novice)
on Aug 30, 2012 at 14:13 UTC ( #990762=perlquestion: print w/replies, xml ) Need Help??
tmurnane has asked for the wisdom of the Perl Monks concerning the following question:

When running on HP, is there a way tell if it is IA64 through Code?

I'm trying to do the following:

If OS Arch is HPIA64
run setupHPIA64.bin
run setupHP.bin

Replies are listed 'Best First'.
Re: Tell if arch is HP or HPIA64
by choroba (Bishop) on Aug 30, 2012 at 14:35 UTC
    I needed a similar thing once, could not think of anything better than this:
    sub arch { my $arch = `$^X -v`; $arch =~ s/.* built for //s; $arch =~ s/\n.*//s; return $arch; }
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
      $ perl -v |ack "built for" This is perl 5, version 14, subversion 1 (v5.14.1) built for MSWin32-x +86-multi-thread $ perl -V:archname archname='MSWin32-x86-multi-thread'; $ perl -MConfig -le " print $Config{archname} " MSWin32-x86-multi-thread

        Thanks all

        Since I'm doing this from within a script and only have the issue on HP, I have the following:

        my $os = $^O; my $OS = "Win32"; SWITCH: { $os =~ /^s/i && do { $OS = "SunOS"; last SWITCH; }; $os =~ /^l/i && do { $OS = "Linux"; last SWITCH; }; $os =~ /^a/i && do { $OS = "AIX"; last SWITCH; }; $os =~ /^h/i && do { $OS = $Config{'archname'} =~ /64/ ? "HPIA64" : + "HP"; last SWITCH; }; }


        Thanks for the enlightenment! I knew it should be possible, but was not able to find it faster than typing the code.
        لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

      Using Config::Perl::V you can get the %Config settings that affect the build as well as the flags used to build the perl binary:

      $ perl -MConfig::Perl::V=myconfig -MData::Dumper -e'print Dumper (myco +nfig)' --- lots of output here

      Enjoy, Have FUN! H.Merijn
Re: Tell if arch is HP or HPIA64
by Anonymous Monk on Aug 30, 2012 at 14:21 UTC
    perl "-V:.+" | grep 64
Re: Tell if arch is HP or HPIA64
by Anonymous Monk on Aug 30, 2012 at 21:33 UTC
    But a Perl "built for" IA could run on IA64.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://990762]
Approved by herveus
[ambrus]: Yes, I was explaining him why I believe it's impossible.
[Corion]: But he doesn't want to listen or does he not understand why/where it's impossible to get from the input to the output?
[Corion]: (or both?)
[marto]: "My solution is I just don’t use these tools anymore".

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2017-12-12 13:26 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (332 votes). Check out past polls.