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

Re: Tell if arch is HP or HPIA64

by choroba (Chancellor)
on Aug 30, 2012 at 14:35 UTC ( #990772=note: print w/replies, xml ) Need Help??

in reply to Tell if arch is HP or HPIA64

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; }
لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ

Replies are listed 'Best First'.
Re^2: Tell if arch is HP or HPIA64
by Anonymous Monk on Aug 30, 2012 at 14:44 UTC
    $ 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.
      لսႽ ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
Re^2: Tell if arch is HP or HPIA64
by Tux (Abbot) on Aug 30, 2012 at 16:18 UTC

    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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://990772]
[marto]: I think the long term solution would be to have sysadmins that do their job, so I don't have to do everything :P
[marto]: they already have an entire BMC patrol system, which they disabled, because it was sending out spurious messages. So rather than fix the issue, or even find out what it was, they turned it off. No messages, can't be any problems, right?
[Corion]: marto: But having open tickets / incidents increases the pressure on them ;) Of course, likely your contract / SLA specifies an upper limit for the number of incidents :-D
[Corion]: marto: Ow ...
[marto]: Corion They don't get into trouble for the number of tickets, or even breached tickets they have
[marto]: which is a core issue with the client
[Corion]: marto: Yeah, I can imagine that

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (8)
As of 2017-01-24 10:18 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (203 votes). Check out past polls.