Acpi::Battery - A class to get informations about your battery.
use Acpi::Battery;
$battery = Acpi::Battery->new;
if($battery->batteryOnLine == 0){
print "Battery online\n";
print $battery->getCharge."\n";
print "Time remaining ".$batteyr->getHoursLeft.":".$battery->getMinutesLeft."\n";
}
else{
print "Battery offline\n";
}
Acpi::Battery is used to have information about your battery.It's specific for GNU/Linux
This sections contains only the methods in Battery.pm itself.
- new();
Contructor for the class
- getBatteryInfo();
Return a hash composed by the name of the battery and the information find in /proc/acpi/battery/BATX/info.
Takes 1 arg : -
- 0
-
The information that you would find !!
- getBatteryState();
Return a hash composed by the name of the battery and the information find in /proc/acpi/battery/BATX/state.
Takes 1 arg : -
- 0
-
The information that you would find !!
- batteryOnLine();
Return 0 if the battery is online else -1.
- nbBattery();
Return the number of battery present.
- getCharge();
Return the pourcentage of the battery.
- getHoursLeft();
Return the hours left behind the battery will be down.
- getMinutesLeft();
Return the minutes left behind the battery will be down.
- getLastFull();
Return a hash composed by the name of the battery and the last full capacity.
- getLastFullTotal();
Return the last full capacity of all batteries.
- getPresent();
Return a hash composed by the name of the battery and 0 or -1 if it's present or not.
- getDesignCapacity();
Return a hash composed by the name of the battery and the design capacity.
- getBatteryTechnology();
Return a hash composed by the name of the battery and the technology.
- getBatteryType();
Return a hash composed by the name of the battery and the type.
- getOEMInfo();
Return a hash composed by the name of the battery and the oem info.
- getChargingState();
Return a hash composed by the name of the battery and 0 or -1 if it's charging or not.
- getCapacityState();
Return a hash composed by the name of the battery and 0 or -1 if if the capacity state is ok or not.
- getRemainingTotal();
Return the remaining capacity of all batteries.
- getPresentRateTotal();
Return the present rate of all batteries.
- getPresentVoltageTotal();
Return the present voltage of all batteries.