Hardware/Fan.pm

filter: Statementstmt 100% 9 / 9 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 3 / 3 Podpod n/a totaltotal 100% 12 / 12 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Hardware/Battery.pm ↑ Summary Hardware/Temperature.pm »
1 #
2 # $Id$
3 #
4 # harware::fan Brik
5 #
6 package Metabrik::Hardware::Fan;
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 1 ▶use base qw(Metabrik::File::Text);
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 sub brik_properties {
13 return {
14 revision => '$Revision$',
15 tags => [ qw(unstable) ],
16 author => 'GomoR <GomoR[at]metabrik.org>',
17 license => 'http://opensource.org/licenses/BSD-3-Clause',
18 commands => {
19 info => [ ],
20 #status => [ ],
21 #speed => [ ],
22 #level => [ ],
23 },
24 };
25 }
26  
27 sub info {
28 my $self = shift;
29  
30 my $base_file = '/proc/acpi/ibm/fan';
31 $self->brik_help_run_file_not_found('info', $base_file) or return;
32  
33 my $data = $self->read($base_file) or return;
34 chomp($data);
35  
36 my $info_hash = {};
37  
38 my @lines = split(/\n/, $data);
39 for my $line (split(/\n/, $data)) {
40 my ($name, $value) = $line =~ /^(\S+):\s+(.*)$/;
41  
42 if ($name eq 'commands') {
43 push @{$info_hash->{$name}}, $value;
44 }
45 else {
46 $info_hash->{$name} = $value;
47 }
48 }
49  
50 return $info_hash;
51 }
52  
53 1;
54  
55 __END__
« Hardware/Battery.pm ↑ Summary Hardware/Temperature.pm »