| Acpi documentation | Contained in the Acpi distribution. |
Acpi::Field - A class to extract informations in /proc/acpi/.
use Acpi::Field;
$field = Acpi::Field->new;
print $field->getValueField("/proc/acpi/info","version")."\n";
Acpi::Field is used into Acpi::* to extract informations.
This sections contains only the methods in Field.pm itself.
The path to the file.
The field that used to extract the value.
| Acpi documentation | Contained in the Acpi distribution. |
package Acpi::Field; use strict; our $VERSION = '0.1'; sub new{ my($class) = shift; my($self) = {}; bless($self,$class); return $self; } sub getValueField{ my($self,$file,$field) = @_; my(@ligne,@ligne2); open(FILE,$file) || die "Impossible d'ouvrir $file : $!"; while(<FILE>){ @ligne = split(/:/); if($ligne[0] eq $field){ $ligne[1] =~ s/^\s+//; #Delete space @ligne2 = split(/\s+/,$ligne[1]); close(FILE); return $ligne2[0]; } } close(FILE); } 1; __END__