App-Device-Chip-sensor
view release on metacpan or search on metacpan
config => HASH
Optional HASH reference containing extra chip configuration to set up
using the configure method once mounted.
chips
@chips = await $app->chips;
An asynchronous memoized lazy accessor for the list of Device::Chip
instances, whose class names are taken from the remaining commandline
arguments after the options are parsed.
sensors
@sensors = await $app->sensors;
An asynchronous memoized lazy accessor for the list of
Device::Chip::Sensor instances of each of the configured chips (from
the "chips" method).
run
await $app->run;
An asynchronous method which performs the actual run loop of the sensor
application. This implements the main application logic, of regular
collection of values from all of the sensor instances and reporting
them to the "output_readings" method.
In normal circumstances the Future instance returned by this method
would remain pending for the lifetime of the program, and not complete.
For an application that has nothing else to perform concurrently it can
simply await this future to run the logic. If it has other logic to
perform as well it could combine this with other futures using a
Future->needs_all or similar techniques.
lib/App/Device/Chip/sensor.pm view on Meta::CPAN
type => $type,
adapter => $adapter,
pairgrep { defined $b } %config{qw( mountopts config )}
};
}
=head2 chips
@chips = await $app->chips;
An asynchronous memoized lazy accessor for the list of L<Device::Chip>
instances, whose class names are taken from the remaining commandline
arguments after the options are parsed.
=cut
field $_chips; # arrayref
async method chips
{
return @$_chips if $_chips;
lib/App/Device/Chip/sensor.pm view on Meta::CPAN
push @$_chips, $chip;
}
return @$_chips;
}
=head2 sensors
@sensors = await $app->sensors;
An asynchronous memoized lazy accessor for the list of L<Device::Chip::Sensor>
instances of each of the configured chips (from the L</chips> method).
=cut
field $_sensors; # arrayref
field $_chipname_width;
field $_sensorname_width;
sub _chipname ( $chip ) { return ( ref $chip ) =~ s/^Device::Chip:://r }
lib/App/Device/Chip/sensor.pm view on Meta::CPAN
return @$_sensors;
}
async method after_sensors ( @sensors ) { }
=head2 run
await $app->run;
An asynchronous method which performs the actual run loop of the sensor
application. This implements the main application logic, of regular collection
of values from all of the sensor instances and reporting them to the
L</output_readings> method.
In normal circumstances the L<Future> instance returned by this method would
remain pending for the lifetime of the program, and not complete. For an
application that has nothing else to perform concurrently it can simply
C<await> this future to run the logic. If it has other logic to perform as
well it could combine this with other futures using a C<< Future->needs_all >>
or similar techniques.
( run in 0.275 second using v1.01-cache-2.11-cpan-05444aca049 )