.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Sys::Info::OS 3pm" .TH Sys::Info::OS 3pm "2022-12-06" "perl v5.36.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Sys::Info::OS .SH "VERSION" .IX Header "VERSION" version 0.7807 .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 3 \& use Sys::Info; \& my $info = Sys::Info\->new; \& my $os = $info\->os(%options); .Ve .PP or .PP .Vb 2 \& use Sys::Info::OS; \& my $os = Sys::Info::OS\->new(%options); .Ve .PP Example: .PP .Vb 1 \& use Data::Dumper; \& \& warn "Collected information can be incomplete\en" if $os\->is_unknown; \& \& my %fs = $os\->fs; \& print Data::Dumper\->Dump([\e%fs], [\*(Aq*FILE_SYSTEM\*(Aq]); \& \& print "B1ll G4teZ rull4z!\en" if $os\->is_windows; \& print "Pinguin detected!\en" if $os\->is_linux; \& if ( $os\->is_windows ) { \& printf "This is a %s based system\en", $os\->is_winnt ? \*(AqNT\*(Aq : \*(Aq9.x\*(Aq; \& } \& printf "Operating System: %s\en", $os\->name( long => 1 ); \& \& my $user = $os\->login_name( real => 1 ) || $os\->login_name || \*(AqUser\*(Aq; \& print "$user, You\*(Aqve Got The P.O.W.E.R.!\en" if $os\->is_root; \& \& if ( my $up = $os\->uptime ) { \& my $tick = $os\->tick_count; \& printf "Running since %s\en" , scalar localtime $up; \& printf "Uptime: %.2f hours\en" , $tick / (60*60 ); # probably windows \& printf "Uptime: %.2f days\en" , $tick / (60*60*24 ); # might be windows \& printf "Uptime: %.2f months\en", $tick / (60*60*24*30); # hmm... smells like tux \& } .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" Supplies detailed operating system information. .SH "NAME" Sys::Info::OS \- Detailed os information. .SH "METHODS" .IX Header "METHODS" .SS "new" .IX Subsection "new" Object constructor. .SS "name" .IX Subsection "name" Returns the \s-1OS\s0 name. Supports these named parameters: \f(CW\*(C`edition\*(C'\fR, \f(CW\*(C`long\*(C'\fR: .PP .Vb 2 \& # also include the edition info if present \& $os\->name( edition => 1 ); .Ve .PP This will return the long \s-1OS\s0 name (with build number, etc.): .PP .Vb 2 \& # also include the edition info if present \& $os\->name( long => 1, edition => 1 ); .Ve .SS "version" .IX Subsection "version" Returns the \s-1OS\s0 version. .SS "build" .IX Subsection "build" Returns the \s-1OS\s0 build number or build date, depending on the system. .SS "uptime" .IX Subsection "uptime" Returns the uptime as a unix timestamp. .SS "tick_count" .IX Subsection "tick_count" Returns the uptime in seconds since the machine booted. .SS "node_name" .IX Subsection "node_name" Machine name .SS "domain_name" .IX Subsection "domain_name" Returns the network domain name. .PP Synonyms: .IP "workgroup" 4 .IX Item "workgroup" .SS "login_name" .IX Subsection "login_name" Returns the name of the effective user. Supports parameters in \&\f(CW\*(C`name => value\*(C'\fR format. Accepted parameters: \f(CW\*(C`real\*(C'\fR: .PP .Vb 1 \& my $user = $os\->login_name( real => 1 ) || $os\->login_name; .Ve .SS "ip" .IX Subsection "ip" Returns the \s-1IP\s0 number. .SS "fs" .IX Subsection "fs" Returns an info hash about the filesystem. The contents of the hash can vary among different systems. .SS "host_name" .IX Subsection "host_name" .SS "time_zone" .IX Subsection "time_zone" .SS "product_type" .IX Subsection "product_type" .SS "bitness" .IX Subsection "bitness" If successful, returns the bitness ( \f(CW32\fR or \f(CW64\fR ) of the \s-1OS.\s0 Returns false otherwise. .SS "meta" .IX Subsection "meta" Returns a hash containing various informations about the \s-1OS.\s0 .SS "cdkey" .IX Subsection "cdkey" .SS "locale" .IX Subsection "locale" .SH "UTILITY METHODS" .IX Header "UTILITY METHODS" These are some useful utility methods. .SS "is_windows" .IX Subsection "is_windows" Returns true if the os is windows. Synonyms: .IP "is_win32" 4 .IX Item "is_win32" .PD 0 .IP "is_win" 4 .IX Item "is_win" .PD .SS "is_winnt" .IX Subsection "is_winnt" Returns true if the \s-1OS\s0 is a \s-1NT\s0 based system (\s-1NT/2000/XP/2003\s0). .PP Always returns false if you are not under windows or you are not under a \s-1NT\s0 based system. .SS "is_win95" .IX Subsection "is_win95" Returns true if the \s-1OS\s0 is a 9x based system (95/98/Me). .PP Always returns false if you are not under Windows or Windows9x. .PP Synonyms: .IP "is_win9x" 4 .IX Item "is_win9x" .SS "is_linux" .IX Subsection "is_linux" Returns true if the os is linux. Synonyms: .IP "is_lin" 4 .IX Item "is_lin" .SS "is_bsd" .IX Subsection "is_bsd" Returns true if the os is (free|open|net)bsd. .SS "is_unknown" .IX Subsection "is_unknown" Returns true if this module does not support the \s-1OS\s0 directly. .SS "is_root" .IX Subsection "is_root" Returns true if the current user has admin rights. Synonyms: .IP "is_admin" 4 .IX Item "is_admin" .PD 0 .IP "is_admin_user" 4 .IX Item "is_admin_user" .IP "is_adminuser" 4 .IX Item "is_adminuser" .IP "is_root_user" 4 .IX Item "is_root_user" .IP "is_rootuser" 4 .IX Item "is_rootuser" .IP "is_super_user" 4 .IX Item "is_super_user" .IP "is_superuser" 4 .IX Item "is_superuser" .IP "is_su" 4 .IX Item "is_su" .PD .SH "CAVEATS" .IX Header "CAVEATS" .IP "\(bu" 4 I don't have access to all operating systems in the world, so this module (currently) only supports Windows, Linux and (Free)BSD. Windows support is better. If you want support for some other \s-1OS,\s0 you'll need to write the driver yourself. Anything other than natively supported systems will fall-back to the generic \f(CW\*(C`Unknown\*(C'\fR driver which has \fIvery\fR limited capabilities. .IP "\(bu" 4 \&\fBWin32::IsAdminUser()\fR implemented in 5.8.4 (However, it is possible to manually upgrade the \f(CW\*(C`Win32\*(C'\fR module). If your ActivePerl is older than this, \f(CW\*(C`is_admin\*(C'\fR method will always returns false. (There \fImay\fR be a workaround for that). .IP "\(bu" 4 Contents of the filesystem hash may change in further releases. .IP "\(bu" 4 Filesystem [Windows] .Sp File system information can not be extracted under restricted environments. If this is the case, we'll get an \&\fIaccess is denied\fR error. .IP "\(bu" 4 Bitness has some problems [Linux, \s-1BSD\s0], especially on the os side. .SH "SEE ALSO" .IX Header "SEE ALSO" Win32, \s-1POSIX\s0, Sys::Info, Sys::Info::Device, . .SH "AUTHOR" .IX Header "AUTHOR" Burak Gursoy .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2006 by Burak Gursoy. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.