|laziness, impatience, and hubris|
Moose: using value of one attribute in another attributeby mimosinnet (Sexton)
|on Jan 11, 2013 at 23:16 UTC||Need Help??|
mimosinnet has asked for the
wisdom of the Perl Monks concerning the following question:
The Acpi::Battery distribution uses the old location for battery information (/proc/acpi/battery/...) and, as an exercise (still in the basic learning process), I have tried to see if I could replicate the code with the new location (/sys/class/power_supply/...). In the process, this code seems to easily get the values from the file /sys/class/power_supply/uevent:
The package Acpi::Battery::Values gets the values from the file /sys/class/power_supply/uevent. Very unsure if this is the right approach, although somehow it works!.
This is the code that calls to Acpi::Battery::Values
Running the code produces this output;
I am stuck at how to use the value of the attribute 'directory' in the Acpi::Battery::Values object to dynamically create the other attributes, so different 'batteries' can be read. I very much appreciate any hints on code or documentation.
Thanks for your attention.