Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

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.


#! /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.


Replies are listed 'Best First'.
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.


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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1004353]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2018-06-20 12:16 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (116 votes). Check out past polls.