Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: I want to get os all configuration

by Old_Gray_Bear (Bishop)
on Nov 17, 2012 at 21:22 UTC ( #1004353=note: print w/ replies, xml ) Need Help??


in reply to I want to get os all configuration

If I understand you, what you are looking for is a combination of $^O and several CPAN modules. Once you have the operating system name in hand, you use the functions provided by packages in the $^O::Sysinfo or Win32::SystemInfo (in the case of Windows) name space to extract the information you want.

Example:

#! /usr/local/bin/perl use strict; use warnings; use Linux::SysInfo; use Win32::SystemInfo; my $this_system = $^O; if ($this_system eq 'MSwin32') { my %windata; Win32::SystemInfo::MemoryStatus(%windata); #### # process the results #### } elsif ($this_system eq 'Linux') { my %linuxdata; %linuxdata = Linux::SysInfo::sysinfo() or die "Linux::SysInfo::sys +info() failed"; ##### # process the results ##### } else { die "Undefined OS -- $this_system"; } exit(0);

----
I Go Back to Sleep, Now.

OGB


Comment on Re: I want to get os all configuration
Select or Download Code
Re^2: I want to get os all configuration
by joyeux (Initiate) on Nov 18, 2012 at 03:03 UTC

    Hi Old_Gray_Bear, Thank u so much for ur help..Also i want to get computer name,full computer name,workgroup,system type information...could please help me.. Thanks and Regards Joyeux

      Are you aware that perlmonks is not IRC? Please show some effort to make your postings readable.

      CPAN has some modules to fetch system information. Use the search function.

      The "workgroup" concept is specific for MS Windows. The concept of having two different names is also a Windows concept. You won't find either on Linux or BSDs.

      Perhaps all you really want is some system information program like BGInfo.

      Alexander

      --
      Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1004353]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (8)
As of 2014-07-14 08:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (257 votes), past polls