Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

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

Comment on I want to get os all configuration
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.

    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

      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: perlquestion [id://1004323]
Approved by Old_Gray_Bear
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (8)
As of 2014-12-29 09:17 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (185 votes), past polls