File Coverage

blib/lib/Lab/Moose/Instrument/SCPI/Unit.pm
Criterion Covered Total %
statement 17 22 77.2
branch n/a
condition n/a
subroutine 6 8 75.0
pod 2 2 100.0
total 25 32 78.1


line stmt bran cond sub pod time code
1             package Lab::Moose::Instrument::SCPI::Unit;
2             $Lab::Moose::Instrument::SCPI::Unit::VERSION = '3.881';
3             #ABSTRACT: Role for SCPI UNIT subsystem.
4              
5 1     1   6389 use v5.20;
  1         4  
6              
7 1     1   6 use Moose::Role;
  1         3  
  1         8  
8 1     1   5907 use Lab::Moose::Instrument qw/setter_params getter_params validated_channel_setter validated_getter/;
  1         2  
  1         71  
9 1     1   6 use Lab::Moose::Instrument::Cache;
  1         2  
  1         11  
10 1     1   703 use MooseX::Params::Validate;
  1         2  
  1         9  
11 1     1   528 use Carp;
  1         4  
  1         216  
12              
13              
14             cache unit_power => ( getter => 'unit_power_query' );
15              
16             sub unit_power_query {
17 0     0 1   my ( $self, %args ) = validated_getter( \@_ );
18              
19 0           return $self->cached_unit_power(
20             $self->query( command => "UNIT:POWer?", %args ) );
21             }
22              
23             sub unit_power {
24 0     0 1   my ( $self, $channel, $value, %args ) = validated_channel_setter( \@_ );
25 0           $self->write(
26             command => sprintf( "UNIT:POWer %s", $value ),
27             %args
28             );
29 0           $self->cached_unit_power($value);
30             }
31              
32             1;
33              
34             __END__
35              
36             =pod
37              
38             =encoding UTF-8
39              
40             =head1 NAME
41              
42             Lab::Moose::Instrument::SCPI::Unit - Role for SCPI UNIT subsystem.
43              
44             =head1 VERSION
45              
46             version 3.881
47              
48             =head1 METHODS
49              
50             =head2 unit_power_query
51              
52             =head2 unit_power
53              
54             Set/Get amplitude units for the input, output and display.
55             Allowed values are DBM|DBMV|DBUV|DBUA|V|W|A.
56              
57             =head1 COPYRIGHT AND LICENSE
58              
59             This software is copyright (c) 2023 by the Lab::Measurement team; in detail:
60              
61             Copyright 2018 Eugeniy E. Mikhailov
62             2020 Andreas K. Huettel
63              
64              
65             This is free software; you can redistribute it and/or modify it under
66             the same terms as the Perl 5 programming language system itself.
67              
68             =cut