/usr/share/perl5/Sys/Info/Device.pm is in libsys-info-base-perl 0.7804-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | package Sys::Info::Device;
use strict;
use warnings;
use vars qw( $VERSION );
use constant SUPPORTED => qw( CPU BIOS );
use Carp qw( croak );
use base qw( Sys::Info::Base );
use Sys::Info::Constants qw( OSID );
$VERSION = '0.7804';
BEGIN {
MK_ACCESSORS: {
no strict qw(refs);
foreach my $device ( SUPPORTED ) {
*{ '_device_' . lc $device } = sub {
my $self = shift;
return Sys::Info::Base->load_module(
'Sys::Info::Device::' . $device
)->new(@_);
}
}
}
}
sub new {
my($class, @args) = @_;
my $device = shift @args or croak 'Device ID is missing';
my $self = {};
bless $self, $class;
my $method = '_device_' . lc $device;
croak "Bogus device ID: $device" if ! $self->can( $method );
return $self->$method( @args ? @args : () );
}
sub _device_available {
my $self = shift;
my $class = ref $self || $self;
my @buf;
local $@;
local $SIG{__DIE__};
foreach my $test ( SUPPORTED ) {
my $eok = eval { $class->new( $test ); 1; };
next if $@ || ! $eok;
push @buf, $test;
}
return @buf;
}
1;
__END__
=head1 NAME
Sys::Info::Device - Information about devices
=head1 SYNOPSIS
use Sys::Info;
my $info = Sys::Info->new;
my $device = $info->device( $device_id );
my @available = $info->device('available');
or
use Sys::Info::Device;
my $device = Sys::Info::Device->new( $device_id );
my @available = Sys::Info::Device->new('available');
=head1 DESCRIPTION
This document describes version C<0.7804> of C<Sys::Info::Device>
released on C<21 January 2015>.
This is an interface to the available devices such as the C<CPU>.
=head1 METHODS
=head2 new DEVICE_ID
Returns an object to the related device or dies if C<DEVICE_ID> is
bogus or false.
If C<DEVICE_ID> has the value of C<available>, then the names of the
available devices will be returned.
=head1 SEE ALSO
L<Sys::Info::Device::CPU>, L<Sys::Info>.
=head1 AUTHOR
Burak Gursoy <burak@cpan.org>.
=head1 COPYRIGHT
Copyright 2006 - 2015 Burak Gursoy. All rights reserved.
=head1 LICENSE
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself, either Perl version 5.16.2 or,
at your option, any later version of Perl 5 you may have available.
=cut
|