File Coverage

blib/lib/Lab/Moose/Instrument/SCPI/Output/State.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::Output::State;
2             $Lab::Moose::Instrument::SCPI::Output::State::VERSION = '3.881';
3             #ABSTRACT: Role for the SCPI OUTPut:STATe subsystem
4              
5 3     3   2289 use v5.20;
  3         10  
6              
7 3     3   17 use Moose::Role;
  3         7  
  3         18  
8 3     3   14394 use Moose::Util::TypeConstraints 'enum';
  3         7  
  3         23  
9 3     3   1248 use Lab::Moose::Instrument::Cache;
  3         8  
  3         42  
10 3     3   1602 use Lab::Moose::Instrument qw/validated_getter validated_setter/;
  3         7  
  3         159  
11              
12 3     3   22 use namespace::autoclean;
  3         8  
  3         21  
13              
14              
15             cache output_state => ( getter => 'output_state_query' );
16              
17             sub output_state_query {
18 0     0 1   my ( $self, %args ) = validated_getter( \@_ );
19              
20 0           return $self->cached_output_state(
21             $self->query( command => "OUTP:STAT?", %args ) );
22             }
23              
24             sub output_state {
25 0     0 1   my ( $self, $value, %args ) = validated_setter(
26             \@_,
27             value => { isa => enum( [qw/ON OFF/] ) }
28             );
29              
30 0           $self->write( command => "OUTP:STAT $value", %args );
31 0           $self->cached_output_state($value);
32             }
33              
34             1;
35              
36             __END__
37              
38             =pod
39              
40             =encoding UTF-8
41              
42             =head1 NAME
43              
44             Lab::Moose::Instrument::SCPI::Output::State - Role for the SCPI OUTPut:STATe subsystem
45              
46             =head1 VERSION
47              
48             version 3.881
49              
50             =head1 METHODS
51              
52             =head2 output_state_query
53              
54             =head2 output_state
55              
56             $self->output_state(value => 'ON');
57             $self->output_state(value => 'OFF');
58              
59             Query/Set whether output is on or off. Allowed values: C<ON, OFF>.
60              
61             =head1 COPYRIGHT AND LICENSE
62              
63             This software is copyright (c) 2023 by the Lab::Measurement team; in detail:
64              
65             Copyright 2017 Simon Reinhardt
66             2020 Andreas K. Huettel
67              
68              
69             This is free software; you can redistribute it and/or modify it under
70             the same terms as the Perl 5 programming language system itself.
71              
72             =cut