Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- http://cpansearch.perl.org/src/MSULLAND/Device-USB-PCSensor-HidTEMPer-0.03/lib/Device/USB/PCSensor/HidTEMPer/TEMPer.pm
- ...
- use constant SUPPORTED_DEVICES => {
- 0x5b => {
- 'name' => 'HidTEMPerNTC',
- 'module' => 'Device::USB::PCSensor::HidTEMPer::NTC'
- },
- 0x58 => {
- 'name' => 'HidTEMPer',
- 'module' => 'Device::USB::PCSensor::HidTEMPer::TEMPer'
- }
- };
- ..
- # This functions detects the correct object to be created and returned.
- # Returns undef if not supported device was found.
- sub _init_device
- {
- my $prototype = Device::USB::PCSensor::HidTEMPer::Device->new( $_[0] );
- - my $parameters = (SUPPORTED_DEVICES)[0]{$prototype->identifier()};
- + my $parameters = SUPPORTED_DEVICES->{$prototype->identifier()};
- return undef unless defined $parameters;
- bless $prototype, $parameters->{module};
- return $prototype->init();
- }
Advertisement
Add Comment
Please, Sign In to add comment