lib/App/SeismicUnixGui/misc/oop_declare_data_in.pm untested

filter: Statementstmt 0.0% 0 / 84 Branchbran 0.0% 0 / 28 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 27 Podpod 0.0% 0 / 26 totaltotal 0.0% 0 / 165 CC 15 SCAR 33.8
CC
15
Cov
0%
set_suffix_type_in
72.0
set_suffix_type_out
72.0
empty
2.0
CRAP 29.3
1 package App::SeismicUnixGui::misc::oop_declare_data_in;
2 use Moose;
3 our $VERSION = '0.0.1';
4  
5 =pod
6  
7 =head1 DOCUMENTATION
8  
9 =head2 SYNOPSIS
10  
11 PERL PROGRAM NAME: data_in
12 AUTHOR: Juan Lorenzo
13 DATE: Nov 29 2017,
14  
15 DESCRIPTION:
16 Version: 1.1
17  
18 =head2 USE
19  
20 =head3 NOTES
21  
22 =head4
23 Examples
24  
25 =head3 SEISMIC UNIX NOTES
26  
27  
28 =head4 CHANGES and their DATES
29  
30  
31 =cut
32  
33 =head2 Default perl lines for
34  
35 declaring required packages
36  
37 =cut
38  
39 =head2 data
40
41 private hash
42  
43 =cut
44  
45 my $oop_declare_data_in = {
46 _suffix_type => '',
47 _suffix_type_in => '',
48 _suffix_type_out => '',
49 _param_labels_aref => '',
50 _param_values_aref => '',
51 };
52  
53 my ( @data_in, @data_out, @inbound_notes, @outbound_notes );
54  
55 =head2 sub get_section
56  
57  
58 =cut
59  
60 sub empty {
61 my ($self) = @_;
62  
63 $outbound_notes[0] = "";
64  
65 return ();
66 }
67  
68 sub inbound_section {
69 my ($self) = @_;
70  
71 # print("oop_declare_data_in,inbound_section,notes:\n @inbound_notes\n");
72  
73 return ( \@inbound_notes );
74  
75 }
76  
77 sub outbound_section {
78 my ($self) = @_;
79  
80 # print("oop_declare_data_in,outbound_section,notes:\n @outbound_notes\n");
81 return ( \@outbound_notes );
82  
83 }
84  
85 sub set_bin_in {
86  
87 $inbound_notes[1] =
88 "\t" . 'my (@file_in);' . "\n\t" . 'my (@bin_file_in,@inbound);';
89 $inbound_notes[2] =
90 "\t" . '$bin_file_in[1]' . "\t" . '= $file_in[1].$suffix_bin;';
91 $inbound_notes[3] = "\t"
92 . '$inbound[1]' . "\t"
93 . '= $DATA_SEISMIC_BIN.' . "'/'"
94 . '.$bin_file_in[1];';
95 }
96  
97 sub set_bin_out {
98 $outbound_notes[1] =
99 "\t" . 'my (@file_out);' . "\n\t" . 'my (@bin_file_out,@outbound);';
100  
101 $outbound_notes[2] =
102 "\t" . '$bin_file_out[1]' . "\t" . '= $file_out[1].$suffix_bin;';
103 $outbound_notes[3] = "\t"
104 . '$outbound[1]' . "\t"
105 . '= $DATA_SEISMIC_BIN.' . "'/'"
106 . '.$bin_file_out[1];';
107 }
108  
109 sub set_text_in {
110  
111 $inbound_notes[1] =
112 "\t" . 'my (@file_in);' . "\n\t" . 'my (@text_file_in,@inbound);';
113 $inbound_notes[2] =
114 "\t" . '$text_data_in[1]' . "\t" . '= $file_in[1].$suffix_text;';
115 $inbound_notes[3] = "\t"
116 . '$inbound[1]' . "\t"
117 . '= $DATA_SEISMIC_TXT.' . "'/'"
118 . '.$text_data_in[1];';
119  
120 }
121  
122 sub set_text_out {
123 $outbound_notes[1] =
124 "\t" . 'my (@file_out);' . "\n\t" . 'my (@text_file_out,@outbound);';
125  
126 $outbound_notes[2] =
127 "\t" . '$text_data_out[1]' . "\t" . '= $file_out[1].$suffix_text;';
128 $outbound_notes[3] = "\t"
129 . '$outbound[1]' . "\t"
130 . '= $DATA_SEISMIC_TXT.' . "'/'"
131 . '.$text_data_out[1];';
132  
133 }
134  
135 sub set_segb_out {
136  
137 $outbound_notes[1] =
138 "\t" . 'my (@file_out);' . "\n\t" . 'my (@segbdata_out,@outbound);';
139 $outbound_notes[2] =
140 "\t" . '$segbdata_out[1]' . "\t" . '= $file_out[1].$suffix_segb;';
141 $outbound_notes[3] = "\t"
142 . '$outbound[1]' . "\t"
143 . '= $DATA_SEISMIC_SEGB.' . "'/'"
144 . '.$segbdata_out[1];';
145  
146 }
147  
148 sub set_segd_out {
149  
150 $outbound_notes[1] =
151 "\t" . 'my (@file_out);' . "\n\t" . 'my (@segddata_out,@outbound);';
152 $outbound_notes[2] =
153 "\t" . '$segddata_out[1]' . "\t" . '= $file_out[1].$suffix_segd;';
154 $outbound_notes[3] = "\t"
155 . '$outbound[1]' . "\t"
156 . '= $DATA_SEISMIC_SEGD.' . "'/'"
157 . '.$segddata_out[1];';
158  
159 }
160  
161 sub set_segy_out {
162  
163 $outbound_notes[1] =
164 "\t" . 'my (@file_out);' . "\n\t" . 'my (@segydata_out,@outbound);';
165 $outbound_notes[2] =
166 "\t" . '$segydata_out[1]' . "\t" . '= $file_out[1].$suffix_segy;';
167 $outbound_notes[3] = "\t"
168 . '$outbound[1]' . "\t"
169 . '= $DATA_SEISMIC_SEGY.' . "'/'"
170 . '.$segydata_out[1];';
171  
172 }
173  
174 sub set_su_in {
175 $inbound_notes[1] =
176 "\t" . 'my (@file_in);' . "\n\t" . 'my (@sudata_in,@inbound);';
177  
178 $inbound_notes[2] =
179 "\t" . '$sudata_in[1]' . "\t" . '= $file_in[1].$suffix_su;';
180 $inbound_notes[3] = "\t"
181 . '$inbound[1]' . "\t"
182 . '= $DATA_SEISMIC_SU.' . "'/'"
183 . '.$sudata_in[1];';
184  
185 }
186  
187 sub set_su_out {
188  
189 $outbound_notes[1] =
190 "\t" . 'my (@file_out);' . "\n\t" . 'my (@sudata_out,@outbound);';
191 $outbound_notes[2] =
192 "\t" . '$sudata_out[1]' . "\t" . '= $file_out[1].$suffix_su;';
193 $outbound_notes[3] = "\t"
194 . '$outbound[1]' . "\t"
195 . '= $DATA_SEISMIC_SU.' . "'/'"
196 . '.$sudata_out[1];';
197  
198 }
199  
200 =head2 sub _set_segb_out
201  
202 prepare to use segb files
203  
204 =cut
205  
206 sub _set_segb_out {
207 my ($self) = @_;
208 $outbound_notes[0] =
209 "\n\t" . 'my ($DATA_SEISMIC_SEGB) = $Project->DATA_SEISMIC_SEGB();';
210  
211 }
212  
213 =head2 sub _set_segd_out
214  
215 prepare to use segd files
216  
217 =cut
218  
219 sub _set_segd_out {
220 my ($self) = @_;
221 $outbound_notes[0] =
222 "\n\t" . 'my ($DATA_SEISMIC_SEGD) = $Project->DATA_SEISMIC_SEGD();';
223  
224 }
225  
226 =head2 sub _set_segy_out
227  
228 prepare to use segy files
229  
230 =cut
231  
232 sub _set_segy_out {
233 my ($self) = @_;
234 $outbound_notes[0] =
235 "\n\t" . 'my ($DATA_SEISMIC_SEGY) = $Project->DATA_SEISMIC_SEGY();';
236  
237 }
238  
239 =head2 sub _set_su_out
240  
241 prepare to use su files
242  
243 =cut
244  
245 sub _set_su_out {
246 my ($self) = @_;
247 $outbound_notes[0] =
248 "\n\t" . 'my ($DATA_SEISMIC_SU) = $Project->DATA_SEISMIC_SU();';
249  
250 }
251  
252 =head2 sub _set_text_out
253  
254 prepare to use su files
255  
256 =cut
257  
258 sub _set_text_out {
259 my ($self) = @_;
260 $outbound_notes[0] =
261 "\n\t" . 'my ($DATA_SEISMIC_TXT) = $Project->DATA_SEISMIC_TXT();';
262  
263 }
264  
265 =head2 sub _set_bin_out
266  
267 prepare to use su files
268  
269 =cut
270  
271 sub _set_bin_out {
272 my ($variable) = @_;
273 $outbound_notes[0] =
274 "\n\t" . 'my ($DATA_SEISMIC_BIN) = $Project->DATA_SEISMIC_BIN();';
275  
276 }
277  
278 =head2 sub _set_segb_in
279  
280 prepare to use segb files
281  
282 =cut
283  
284 sub _set_segb_in {
285 my ($self) = @_;
286 $inbound_notes[0] =
287 "\n\t" . 'my ($DATA_SEISMIC_SEGB) = $Project->DATA_SEISMIC_SEGB();';
288 }
289  
290 =head2 sub _set_segd_in
291  
292 prepare to use segd files
293  
294 =cut
295  
296 sub _set_segd_in {
297 my ($self) = @_;
298 $inbound_notes[0] =
299 "\n\t" . 'my ($DATA_SEISMIC_SEGD) = $Project->DATA_SEISMIC_SEGD();';
300 }
301  
302 =head2 sub _set_segy_in
303  
304 prepare to use segy files
305  
306 =cut
307  
308 sub _set_segy_in {
309 my ($self) = @_;
310 $inbound_notes[0] =
311 "\n\t" . 'my ($DATA_SEISMIC_SEGY) = $Project->DATA_SEISMIC_SEGY();';
312 }
313  
314 =head2 sub _set_su_in
315  
316 prepare to use su files
317  
318 =cut
319  
320 sub _set_su_in {
321 my ($self) = @_;
322 $inbound_notes[0] =
323 "\n\t" . 'my ($DATA_SEISMIC_SU) = $Project->DATA_SEISMIC_SU();';
324 }
325  
326 =head2 sub _set_text_in
327  
328 prepare to use su files
329  
330 =cut
331  
332 sub _set_text_in {
333 my ($self) = @_;
334 $inbound_notes[0] =
335 "\n\t" . 'my ($DATA_SEISMIC_TXT) = $Project->DATA_SEISMIC_TXT();';
336  
337 }
338  
339 =head2 sub _set_bin_in
340  
341 prepare to use su files
342  
343 =cut
344  
345 sub _set_bin_in {
346 my ($variable) = @_;
347 $inbound_notes[0] =
348 "\n\t" . 'my ($DATA_SEISMIC_BIN) = $Project->DATA_SEISMIC_BIN();';
349  
350 }
351  
352 =pod
353  
354 =pod
355  
356 =head2 subroutine set_suffix_type_in
357  
358 you need to know how many numbers per line
359 will be in the output file
360  
361 =cut
362  
363 sub set_suffix_type_in {
364 my ( $variable, $suffix_type_in ) = @_;
365  
366 if ($suffix_type_in) {
367  
368 if ( $suffix_type_in eq 'segb' ) {
369  
370 _set_segb_in();
371 }
372 elsif ( $suffix_type_in eq 'segd' ) {
373  
374 _set_segd_in();
375  
376 }
377 elsif ( $suffix_type_in eq 'segy' ) {
378  
379 _set_segy_in();
380  
381 }
382 elsif ( $suffix_type_in eq 'su' ) {
383  
384 # print("oop_declare_data_out,set_suffix_type_in,suffix_type_in:$suffix_type_in\n");
385 _set_su_in();
386  
387 }
388 elsif ( $suffix_type_in eq 'text' ) {
389  
390 _set_text_in();
391  
392 }
393 elsif ( $suffix_type_in eq 'bin' ) {
394  
395 _set_bin_in();
396 }
397 else {
398 print("\n");
399 }
400 }
401 }
402  
403 =head2 subroutine set_suffix_type_out
404  
405 you need to know how many numbers per line
406 will be in the output file
407  
408 =cut
409  
410 sub set_suffix_type_out {
411 my ( $variable, $suffix_type_out ) = @_;
412  
413 if ($suffix_type_out) {
414  
415 if ( $suffix_type_out eq 'segb' ) {
416  
417 _set_segb_out();
418  
419 }
420  
421 elsif ( $suffix_type_out eq 'segd' ) {
422  
423 _set_segd_out();
424  
425 }
426 elsif ( $suffix_type_out eq 'segy' ) {
427  
428 # print("oop_declare_data_out,set_suffix_type_out,suffix_type_out:$suffix_type_out\n");
429 _set_segy_out();
430  
431 }
432 elsif ( $suffix_type_out eq 'su' ) {
433  
434 # print("oop_declare_data_out,set_suffix_type_out,suffix_type_out:$suffix_type_out\n");
435 _set_su_out();
436 }
437 elsif ( $suffix_type_out eq 'text' ) {
438  
439 _set_text_out();
440  
441 }
442 elsif ( $suffix_type_out eq 'bin' ) {
443  
444 _set_bin_out();
445  
446 }
447 else {
448 print(
449 "oop_declare_data_out,set_suffix_type_out,suffix_type_out:$suffix_type_out\n"
450 );
451 }
452 }
453 }
454  
455 1;