| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Lab::XPRESS::hub; |
|
2
|
|
|
|
|
|
|
$Lab::XPRESS::hub::VERSION = '3.880'; |
|
3
|
|
|
|
|
|
|
#ABSTRACT: The XPRESS main hub |
|
4
|
|
|
|
|
|
|
|
|
5
|
8
|
|
|
8
|
|
110
|
use v5.20; |
|
|
8
|
|
|
|
|
40
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
8
|
|
|
8
|
|
3263
|
use Lab::Exception; |
|
|
8
|
|
|
|
|
21
|
|
|
|
8
|
|
|
|
|
254
|
|
|
8
|
8
|
|
|
8
|
|
51
|
use strict; |
|
|
8
|
|
|
|
|
15
|
|
|
|
8
|
|
|
|
|
218
|
|
|
9
|
8
|
|
|
8
|
|
41
|
use Exporter 'import'; |
|
|
8
|
|
|
|
|
17
|
|
|
|
8
|
|
|
|
|
242
|
|
|
10
|
8
|
|
|
8
|
|
3558
|
use Module::Load qw/load autoload/; |
|
|
8
|
|
|
|
|
8318
|
|
|
|
8
|
|
|
|
|
88
|
|
|
11
|
8
|
|
|
8
|
|
2067
|
use Try::Tiny; |
|
|
8
|
|
|
|
|
6013
|
|
|
|
8
|
|
|
|
|
491
|
|
|
12
|
8
|
|
|
8
|
|
53
|
use Carp; |
|
|
8
|
|
|
|
|
17
|
|
|
|
8
|
|
|
|
|
1067
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our @EXPORT_OK = qw(DataFile Sweep Frame Instrument Connection); |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub new { |
|
17
|
0
|
|
|
0
|
0
|
0
|
my $proto = shift; |
|
18
|
0
|
|
0
|
|
|
0
|
my $class = ref($proto) || $proto; |
|
19
|
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
0
|
my $self = {}; |
|
21
|
0
|
|
|
|
|
0
|
bless( $self, $class ); |
|
22
|
|
|
|
|
|
|
|
|
23
|
0
|
|
|
|
|
0
|
return $self; |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub DataFile { |
|
28
|
2
|
50
|
|
2
|
0
|
2371
|
my $self = shift if ref( $_[0] ) eq __PACKAGE__; |
|
29
|
2
|
|
|
|
|
13
|
my ( $filenamebase, $foldername ) = @_; |
|
30
|
|
|
|
|
|
|
|
|
31
|
8
|
|
|
8
|
|
4211
|
use Lab::XPRESS::Data::XPRESS_DataFile; |
|
|
8
|
|
|
|
|
26
|
|
|
|
8
|
|
|
|
|
8396
|
|
|
32
|
2
|
50
|
|
|
|
24
|
my $xFile |
|
33
|
|
|
|
|
|
|
= new Lab::XPRESS::Data::XPRESS_DataFile( $filenamebase, $foldername ) |
|
34
|
|
|
|
|
|
|
or die Lab::Exception::CorruptParameter->throw( |
|
35
|
|
|
|
|
|
|
error => "Can't open file $filenamebase\n" ); |
|
36
|
2
|
|
|
|
|
16
|
return $xFile; |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub Sweep { |
|
41
|
2
|
50
|
|
2
|
0
|
38
|
my $self = shift if ref( $_[0] ) eq __PACKAGE__; |
|
42
|
2
|
|
|
|
|
7
|
my $sweep = shift; |
|
43
|
|
|
|
|
|
|
|
|
44
|
2
|
|
|
|
|
7
|
$sweep = "Lab::XPRESS::Sweep::" . $sweep; |
|
45
|
2
|
50
|
|
|
|
202
|
eval "require $sweep; $sweep->import(); 1;" |
|
46
|
|
|
|
|
|
|
or do Lab::Exception::CorruptParameter->throw( error => $@ ); |
|
47
|
|
|
|
|
|
|
|
|
48
|
2
|
|
|
|
|
16
|
return $sweep->new(@_); |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub Frame { |
|
53
|
0
|
0
|
|
0
|
0
|
0
|
my $self = shift if ref( $_[0] ) eq __PACKAGE__; |
|
54
|
|
|
|
|
|
|
|
|
55
|
0
|
|
|
|
|
0
|
my $frame = "Lab::XPRESS::Sweep::Frame"; |
|
56
|
0
|
0
|
|
|
|
0
|
eval "require $frame; $frame->import(); 1;" |
|
57
|
|
|
|
|
|
|
or do Lab::Exception::CorruptParameter->throw( error => $@ ); |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
#or do Lab::Exception::CorruptParameter->throw( error => "Can't locate module $frame\n" ); |
|
60
|
|
|
|
|
|
|
|
|
61
|
0
|
|
|
|
|
0
|
return $frame->new(@_); |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub Instrument { |
|
66
|
10
|
|
|
10
|
0
|
1063
|
my $self = shift; |
|
67
|
10
|
|
|
|
|
24
|
my $instrument; |
|
68
|
10
|
50
|
|
|
|
67
|
if ( ref($self) eq __PACKAGE__ ) { |
|
69
|
0
|
|
|
|
|
0
|
$instrument = shift; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
else { |
|
72
|
10
|
|
|
|
|
28
|
$instrument = $self; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
10
|
|
|
|
|
33
|
my $module = "Lab::Instrument::" . $instrument; |
|
76
|
10
|
|
|
|
|
19
|
my $found_module; |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
try { |
|
79
|
10
|
|
|
10
|
|
702
|
autoload($module); |
|
80
|
10
|
|
|
|
|
479
|
$found_module = 1; |
|
81
|
|
|
|
|
|
|
} |
|
82
|
|
|
|
|
|
|
catch { |
|
83
|
|
|
|
|
|
|
# Do not try to load a Moose driver, if the problem is just |
|
84
|
|
|
|
|
|
|
# a syntax error in the non-Moose driver. |
|
85
|
0
|
0
|
|
0
|
|
0
|
if ( $_ =~ /Compilation failed in require/ ) { |
|
86
|
0
|
|
|
|
|
0
|
die $_; |
|
87
|
|
|
|
|
|
|
} |
|
88
|
10
|
|
|
|
|
132
|
}; |
|
89
|
|
|
|
|
|
|
|
|
90
|
10
|
50
|
|
|
|
291
|
if ($found_module) { |
|
91
|
10
|
|
|
|
|
51
|
return $module->new(@_); |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
0
|
$module = "Lab::Moose::Instrument::" . $instrument; |
|
95
|
0
|
|
|
|
|
0
|
load($module); |
|
96
|
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
0
|
my $args_ref = shift; |
|
98
|
0
|
|
|
|
|
0
|
my $connection_type = delete $args_ref->{connection_type}; |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
# Somewhat problematic, as the args_ref mixes connection options |
|
101
|
|
|
|
|
|
|
# with instrument options. => Better use the Lab::Moose constructor ;) |
|
102
|
|
|
|
|
|
|
return $module->new( |
|
103
|
|
|
|
|
|
|
connection_type => $connection_type, |
|
104
|
|
|
|
|
|
|
connection_options => $args_ref, |
|
105
|
0
|
|
|
|
|
0
|
%{$args_ref}, |
|
|
0
|
|
|
|
|
0
|
|
|
106
|
|
|
|
|
|
|
); |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub Connection { |
|
110
|
1
|
50
|
|
1
|
0
|
147
|
my $self = shift if ref( $_[0] ) eq __PACKAGE__; |
|
111
|
1
|
|
|
|
|
3
|
my $connection = shift; |
|
112
|
|
|
|
|
|
|
|
|
113
|
1
|
|
|
|
|
5
|
$connection = "Lab::Connection::" . $connection; |
|
114
|
1
|
50
|
|
|
|
72
|
eval "require $connection; $connection->import(); 1;" |
|
115
|
|
|
|
|
|
|
or do Lab::Exception::CorruptParameter->throw( error => $@ ); |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
#or do Lab::Exception::CorruptParameter->throw( error => "Can't locate module $connection\n" ); |
|
118
|
|
|
|
|
|
|
|
|
119
|
1
|
|
|
|
|
36
|
return $connection->new(@_); |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
} |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub show_available_objects { |
|
124
|
0
|
0
|
|
0
|
0
|
|
my $self = shift if ref( $_[0] ) eq __PACKAGE__; |
|
125
|
|
|
|
|
|
|
|
|
126
|
0
|
|
|
|
|
|
my $xDIR = $INC{"Lab/XPRESS/hub.pm"}; |
|
127
|
0
|
|
|
|
|
|
$xDIR =~ s/hub.pm//g; |
|
128
|
|
|
|
|
|
|
|
|
129
|
0
|
|
|
|
|
|
opendir( DIR, $xDIR . "Sweep" ); |
|
130
|
0
|
|
|
|
|
|
my @sweeps = readdir(DIR); |
|
131
|
0
|
|
|
|
|
|
shift @sweeps; # shift "." |
|
132
|
0
|
|
|
|
|
|
shift @sweeps; # shift ".." |
|
133
|
|
|
|
|
|
|
|
|
134
|
0
|
|
|
|
|
|
$xDIR =~ s/XPRESS\///g; |
|
135
|
0
|
|
|
|
|
|
opendir( DIR, $xDIR . "Instrument" ); |
|
136
|
0
|
|
|
|
|
|
my @instruments = readdir(DIR); |
|
137
|
0
|
|
|
|
|
|
shift @instruments; # shift "." |
|
138
|
0
|
|
|
|
|
|
shift @instruments; # shift ".." |
|
139
|
|
|
|
|
|
|
|
|
140
|
0
|
|
|
|
|
|
$xDIR =~ s/Instrument\///g; |
|
141
|
0
|
|
|
|
|
|
opendir( DIR, $xDIR . "Connection" ); |
|
142
|
0
|
|
|
|
|
|
my @connections = readdir(DIR); |
|
143
|
0
|
|
|
|
|
|
shift @connections; # shift "." |
|
144
|
0
|
|
|
|
|
|
shift @connections; # shift ".." |
|
145
|
|
|
|
|
|
|
|
|
146
|
0
|
|
|
|
|
|
print "\n\n"; |
|
147
|
0
|
|
|
|
|
|
print "================\n"; |
|
148
|
0
|
|
|
|
|
|
print " XPRESS add-on: \n"; |
|
149
|
0
|
|
|
|
|
|
print "================\n"; |
|
150
|
0
|
|
|
|
|
|
print "\n\n"; |
|
151
|
|
|
|
|
|
|
|
|
152
|
0
|
|
|
|
|
|
print "available connections:\n"; |
|
153
|
0
|
|
|
|
|
|
print "--------------------------\n"; |
|
154
|
0
|
|
|
|
|
|
foreach my $module (@connections) { |
|
155
|
0
|
|
|
|
|
|
$module =~ s/\.pm//g; |
|
156
|
0
|
|
|
|
|
|
print $module. "\n"; |
|
157
|
|
|
|
|
|
|
} |
|
158
|
0
|
|
|
|
|
|
print "--------------------------\n"; |
|
159
|
0
|
|
|
|
|
|
print "\n\n"; |
|
160
|
|
|
|
|
|
|
|
|
161
|
0
|
|
|
|
|
|
print "available Instruments:\n"; |
|
162
|
0
|
|
|
|
|
|
print "--------------------------\n"; |
|
163
|
0
|
|
|
|
|
|
foreach my $module (@instruments) { |
|
164
|
0
|
|
|
|
|
|
$module =~ s/\.pm//g; |
|
165
|
0
|
|
|
|
|
|
print $module. "\n"; |
|
166
|
|
|
|
|
|
|
} |
|
167
|
0
|
|
|
|
|
|
print "--------------------------\n"; |
|
168
|
0
|
|
|
|
|
|
print "\n\n"; |
|
169
|
|
|
|
|
|
|
|
|
170
|
0
|
|
|
|
|
|
print "available sweep modules:\n"; |
|
171
|
0
|
|
|
|
|
|
print "--------------------------\n"; |
|
172
|
0
|
|
|
|
|
|
foreach my $module (@sweeps) { |
|
173
|
0
|
|
|
|
|
|
$module =~ s/\.pm//g; |
|
174
|
0
|
|
|
|
|
|
print $module. "\n"; |
|
175
|
|
|
|
|
|
|
} |
|
176
|
0
|
|
|
|
|
|
print "--------------------------\n"; |
|
177
|
0
|
|
|
|
|
|
print "\n\n"; |
|
178
|
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
} |
|
180
|
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
1; |
|
182
|
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
__END__ |
|
184
|
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
=pod |
|
186
|
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=encoding UTF-8 |
|
188
|
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=head1 NAME |
|
190
|
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
Lab::XPRESS::hub - The XPRESS main hub |
|
192
|
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head1 VERSION |
|
194
|
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
version 3.880 |
|
196
|
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
198
|
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
This software is copyright (c) 2023 by the Lab::Measurement team; in detail: |
|
200
|
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
Copyright 2012 Stefan Geissler |
|
202
|
|
|
|
|
|
|
2013 Alois Dirnaichner, Andreas K. Huettel, Christian Butschkow |
|
203
|
|
|
|
|
|
|
2016 Simon Reinhardt |
|
204
|
|
|
|
|
|
|
2017 Andreas K. Huettel, Simon Reinhardt |
|
205
|
|
|
|
|
|
|
2020 Andreas K. Huettel |
|
206
|
|
|
|
|
|
|
|
|
207
|
|
|
|
|
|
|
|
|
208
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
|
209
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
|
210
|
|
|
|
|
|
|
|
|
211
|
|
|
|
|
|
|
=cut |