MultiChannelInstrument/DeviceCache.pm

filter: Statementstmt 45.4% 15 / 33 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 36.3% 4 / 11 Podpod n/a totaltotal 38.0% 19 / 50 SCAR 20.4
CC
4
Cov
38%
STORE
6.0
FETCH
6.0
EXISTS
6.0
CRAP 7.7
« Instrument/SR830/AuxIn.pm ↑ Summary Connection/LogMethodCall.pm »
1 package Lab::MultiChannelInstrument::DeviceCache;
2 #ABSTRACT: Multi-channel instrument device cache
3 1 $Lab::MultiChannelInstrument::DeviceCache::VERSION = '3.881';
4 1 ▶use v5.20;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 require Tie::Hash;
10 1 ▶use List::MoreUtils qw{ any };
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12  
13 1 our @ISA = 'Tie::ExtraHash';
14  
15 sub TIEHASH {
16 0 ▶ my $class = shift;
Subroutine TIEHASH: not called CC=1 SCAR=6.9
17 0 my $storage = bless [ {}, @_ ], $class;
18 0 return $storage;
19 }
20  
21 sub STORE {
22 0 ▶ $_[0][0]{ $_[1] } = $_[2];
Subroutine STORE: not called CC=2 SCAR=17.9
23 0 ▶ if ( any { $_[1] eq $_ } @{ $_[0][1]->{multichannel_shared_cache} } ) {
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if (&any(sub { $_[1] eq $_; } , @{$_[0][1]{"multichannel_shared_cache"};})) 0 0 0
24 0 $_[0][1]->device_cache( { $_[1] => $_[2] } );
25 }
26 }
27  
28 sub FETCH {
29  
30 0 ▶ if ( any { $_[1] eq $_ } @{ $_[0][1]->{multichannel_shared_cache} } ) {
Subroutine FETCH: not called CC=2 SCAR=17.9
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if (&any(sub { $_[1] eq $_; } , @{$_[0][1]{'multichannel_shared_cache'};})) { } 0 0 0
31 0 return $_[0][1]->device_cache( $_[1] );
32 }
33 else {
34 0 return $_[0][0]{ $_[1] };
35 }
36 }
37  
38 sub EXISTS {
39 0 ▶ if ( any { $_[1] eq $_ } @{ $_[0][1]->{multichannel_shared_cache} } ) {
Subroutine EXISTS: not called CC=2 SCAR=17.9
Subroutine __ANON__: not called CC=1 SCAR=6.9
Branch: 1 branch
BranchTrueFalseTotal
if (&any(sub { $_[1] eq $_; } , @{$_[0][1]{"multichannel_shared_cache"};})) 0 0 0
40 0 return exists $_[0][1]->{device_cache}->{ $_[1] };
41 }
42 0 return exists $_[0][0]->{ $_[1] };
43 }
44  
45 1 1;
46  
47 __END__
48  
49 =pod
50  
51 =encoding UTF-8
52  
53 =head1 NAME
54  
55 Lab::MultiChannelInstrument::DeviceCache - Multi-channel instrument device cache
56  
57 =head1 VERSION
58  
59 version 3.881
60  
61 =head1 COPYRIGHT AND LICENSE
62  
63 This software is copyright (c) 2023 by the Lab::Measurement team; in detail:
64  
65 Copyright 2016 Simon Reinhardt
66 2017 Andreas K. Huettel
67 2020 Andreas K. Huettel
68  
69  
70 This is free software; you can redistribute it and/or modify it under
71 the same terms as the Perl 5 programming language system itself.
72  
73 =cut
« Instrument/SR830/AuxIn.pm ↑ Summary Connection/LogMethodCall.pm »