File Coverage

blib/lib/Metabrik/Hardware/Fan.pm
Criterion Covered Total %
statement 9 24 37.5
branch 0 6 0.0
condition n/a
subroutine 3 5 60.0
pod 1 2 50.0
total 13 37 35.1


line stmt bran cond sub pod time code
1             #
2             # $Id$
3             #
4             # harware::fan Brik
5             #
6             package Metabrik::Hardware::Fan;
7 1     1   1061 use strict;
  1         2  
  1         32  
8 1     1   5 use warnings;
  1         2  
  1         35  
9              
10 1     1   5 use base qw(Metabrik::File::Text);
  1         18  
  1         373  
11              
12             sub brik_properties {
13             return {
14 0     0 1   revision => '$Revision$',
15             tags => [ qw(unstable) ],
16             author => 'GomoR ',
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 0     0 0   my $self = shift;
29              
30 0           my $base_file = '/proc/acpi/ibm/fan';
31 0 0         $self->brik_help_run_file_not_found('info', $base_file) or return;
32              
33 0 0         my $data = $self->read($base_file) or return;
34 0           chomp($data);
35              
36 0           my $info_hash = {};
37              
38 0           my @lines = split(/\n/, $data);
39 0           for my $line (split(/\n/, $data)) {
40 0           my ($name, $value) = $line =~ /^(\S+):\s+(.*)$/;
41              
42 0 0         if ($name eq 'commands') {
43 0           push @{$info_hash->{$name}}, $value;
  0            
44             }
45             else {
46 0           $info_hash->{$name} = $value;
47             }
48             }
49              
50 0           return $info_hash;
51             }
52              
53             1;
54              
55             __END__