Sys::Info::Driver::Unknown::OS - Compatibility layer for unsupported platforms


Sys-Info-Driver-Unknown documentation Contained in the Sys-Info-Driver-Unknown distribution.

Index


Code Index:

NAME

Top

Sys::Info::Driver::Unknown::OS - Compatibility layer for unsupported platforms

SYNOPSIS

Top

-

DESCRIPTION

Top

This document describes version 0.78 of Sys::Info::Driver::Unknown::OS released on 17 April 2011.

-

METHODS

Top

Please see Sys::Info::OS for definitions of these methods and more.

build

domain_name

edition

fs

is_root

login_name

logon_server

meta

name

node_name

tick_count

tz

uptime

version

bitness

SEE ALSO

Top

Sys::Info, Sys::Info::OS.

AUTHOR

Top

Burak Gursoy <burak@cpan.org>.

COPYRIGHT

Top

LICENSE

Top

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.12.3 or, at your option, any later version of Perl 5 you may have available.


Sys-Info-Driver-Unknown documentation Contained in the Sys-Info-Driver-Unknown distribution.

package Sys::Info::Driver::Unknown::OS;
use strict;
use warnings;
use vars qw( $VERSION );
use POSIX ();
use Sys::Info::Constants qw( :unknown );

$VERSION = '0.78';

# So, we don't support $^O yet, but we can try to emulate some features

BEGIN {
    *is_root     = *uptime
                 = *tick_count
                 = sub { 0 }
                 ;
    *domain_name = *edition
                 = *logon_server
                 = sub {}
                 ;
}

sub meta {
    my $self = shift;
    my %info;

    $info{manufacturer}              = undef;
    $info{build_type}                = undef;
    $info{owner}                     = undef;
    $info{organization}              = undef;
    $info{product_id}                = undef;
    $info{install_date}              = undef;
    $info{boot_device}               = undef;
    $info{physical_memory_total}     = undef;
    $info{physical_memory_available} = undef;
    $info{page_file_total}           = undef;
    $info{page_file_available}       = undef;
    # windows specific
    $info{windows_dir}               = undef;
    $info{system_dir}                = undef;
    $info{system_manufacturer}       = undef;
    $info{system_model}              = undef;
    $info{system_type}               = undef;
    $info{page_file_path}            = undef;

    return %info;
}

sub tz {
    my $self = shift;
    return exists $ENV{TZ}
         ? $ENV{TZ}
         : do {
               require POSIX;
               POSIX::strftime('%Z', localtime);
           };
}

sub fs {
    my $self = shift;
    return(
        unknown => 1,
    );
}

sub name {
    my($self, @args) = @_;
    my %opt   = @args % 2 ? () : @args;
    my $uname = $self->uname;
    my $rv    = $opt{long} ? join(q{ }, $uname->{sysname}, $uname->{release})
              :              $uname->{sysname}
              ;
    return $rv;
}

sub version { return shift->uname->{release} }

sub build {
    my $build = shift->uname->{version} || return;
    if ( $build =~ UN_RE_BUILD ) {
        return $1;
    }
    return $build;
}

sub node_name { return shift->uname->{nodename} }

sub login_name {
    my $name;
    my $eok = eval { $name = getlogin };
    return $name;
}

sub bitness {
    my $self = shift;
    return;
}

1;

__END__