Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

I want to get os all configuration

by joyeux (Initiate)
on Nov 17, 2012 at 16:26 UTC ( #1004323=perlquestion: print w/replies, xml ) Need Help??
joyeux has asked for the wisdom of the Perl Monks concerning the following question:

Hi all, i'm new to perl...I want to get operating system all configuration..$^O not this command..could please help me for this.. Thanks and Regards Poongodi

Replies are listed 'Best First'.
Re: I want to get os all configuration
by Old_Gray_Bear (Bishop) on Nov 17, 2012 at 21:22 UTC
    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.


      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: perlquestion [id://1004323]
Approved by Old_Gray_Bear
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2018-04-26 00:56 GMT
Find Nodes?
    Voting Booth?