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

filter: Statementstmt 0.0% 0 / 496 Branchbran 0.0% 0 / 70 Conditioncond 0.0% 0 / 14 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 0.0% 0 / 31 Podpod 0.0% 0 / 26 totaltotal 0.0% 0 / 645 CC 36 SCAR 24.0
CC
36
Cov
0%
get_path4convert_file
30.0
_get_path4spec_file
20.0
_get_path4su_file
20.0
CRAP 11.0
1 package App::SeismicUnixGui::misc::dirs;
2  
3 =head1 DOCUMENTATION
4  
5  
6 =head2 SYNOPSIS
7  
8 PERL PERL PROGRAM NAME: dirs
9 AUTHOR: Juan Lorenzo
10 DATE: May 5 2018
11  
12 DESCRIPTION
13
14 directory service
15 BASED ON:
16 Version 0.1
17  
18 =cut
19  
20 =head2 USE
21  
22 =head3 NOTES
23  
24 =head4 Examples
25  
26  
27 =head2 CHANGES and their DATES
28  
29 =cut
30  
31 use Moose;
32 our $VERSION = '0.0.1';
33  
34 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
35 use aliased 'App::SeismicUnixGui::misc::manage_dirs_by';
36 use Carp;
37  
38 =head2 Instantiate modules
39  
40 =cut
41  
42 my $L_SU_global_constants = L_SU_global_constants->new();
43 my $manage_dirs_by = manage_dirs_by->new();
44 my $var = $L_SU_global_constants->var();
45  
46 my $empty_string = $var->{_empty_string};
47 my $path4SeismicUnixGui = $ENV{'SeismicUnixGui'};
48  
49 # Locate environment variables automatically
50 my @PARENT_DIR_CONVERT = ( "sunix", "misc", "configs" );
51 my @PARENT_DIR_GUI = ( "configs", "specs" );
52 my @PARENT_DIR_TOOLS = ("big_streams");
53 my @PARENT_DIR_SPECS = ("specs");
54 my @PARENT_DIR_SU = ("sunix");
55  
56 my @PARENT_DIR_GEN = (
57 "misc", "geopsy", "messages",
58 "developer/code/sunix", "script"
59 );
60  
61 my @CHILD_DIR_CONVERT = (
62 "", "big_streams", "data", "datum",
63 "filter", "header", "inversion", "migration",
64 "model", "NMO_Vel_Stk", "par", "plot",
65 "shapeNcut", "shell", "statsMath", "transform",
66 "well"
67 );
68  
69 my @CHILD_DIR_GEN = ( "", );
70  
71 my @CHILD_DIR_GUI = (
72 "big_streams", "data", "datum", "filter",
73 "header", "inversion", "migration", "model",
74 "NMO_Vel_Stk", "par", "plot", "shapeNcut",
75 "shell", "statsMath", "transform", "well"
76 );
77  
78 my @CHILD_DIR_TOOLS = ("");
79  
80 my @CHILD_DIR_SPECS = (
81 "big_streams", "data", "datum", "filter",
82 "header", "inversion", "migration", "model",
83 "NMO_Vel_Stk", "par", "plot", "shapeNcut",
84 "shell", "statsMath", "transform", "well"
85 );
86  
87 my @CHILD_DIR_SU = (
88 "data", "datum", "filter", "header",
89 "inversion", "migration", "model", "NMO_Vel_Stk",
90 "par", "plot", "shapeNcut", "shell",
91 "statsMath", "transform", "well"
92 );
93  
94 =head2 private hash
95  
96 =cut
97  
98 my $dirs = {
99 _DIR => '',
100 _path => '',
101 _program_name => '',
102 _ref_ls => '',
103 _PARENT_DIR_CONVERT => \@PARENT_DIR_CONVERT,
104 _PARENT_DIR_GUI => \@PARENT_DIR_GUI,
105 _PARENT_DIR_TOOLS => \@PARENT_DIR_TOOLS,
106 _PARENT_DIR_SPECS => \@PARENT_DIR_SPECS,
107 _PARENT_DIR_SU => \@PARENT_DIR_SU,
108 _PARENT_DIR_GEN => \@PARENT_DIR_GEN,
109 _PARENT_DIR_type => '',
110 _CHILD_DIR_CONVERT => \@CHILD_DIR_CONVERT,
111 _CHILD_DIR_GEN => \@CHILD_DIR_GEN,
112 _CHILD_DIR_GUI => \@CHILD_DIR_GUI,
113 _CHILD_DIR_TOOLS => \@CHILD_DIR_TOOLS,
114 _CHILD_DIR_SPECS => \@CHILD_DIR_SPECS,
115 _CHILD_DIR_SU => \@CHILD_DIR_SU,
116 _CHILD_DIR_type => '',
117 };
118  
119 =head2 sub clear
120  
121 wipe clean private hash values
122  
123 =cut
124  
125 sub clear {
126 my ($self) = @_;
127 $dirs->{_CHILD_DIR} = '';
128 $dirs->{_CHILD_DIR_CONVERT} = '';
129 $dirs->{_CHILD_DIR_GUI} = '';
130 $dirs->{_CHILD_DIR_TOOLS} = '';
131 $dirs->{_CHILD_DIR_SPECS} = '';
132 $dirs->{_CHILD_DIR_SU} = '';
133 $dirs->{_CHILD_DIR_type} = '';
134 $dirs->{_GRANDPARENT_DIR} = '';
135 $dirs->{_PARENT_DIR_CONVERT} = '';
136 $dirs->{_PARENT_DIR_GEN} = '';
137 $dirs->{_PARENT_DIR_GUI} = '';
138 $dirs->{_PARENT_DIR_TOOLS} = '';
139 $dirs->{_PARENT_DIR_SPECS} = '';
140 $dirs->{_PARENT_DIR_SU} = '';
141 $dirs->{_PARENT_DIR_type} = '';
142 $dirs->{_file_name} = '',
143 $dirs->{_program_name} = '';
144 return ();
145 }
146  
147 sub _get_path4SeismicUnixGui {
148 my ($self) = @_;
149 if ( length $path4SeismicUnixGui ) {
150  
151 my $result = $path4SeismicUnixGui;
152 return ($result);
153  
154 }
155 else {
156 print(
157 "dirs, _get_path4SeismicUnixGui,missing variable\n"
158 );
159 }
160 return ();
161 }
162  
163 =head2 sub _get_path4spec_file
164  
165 Find a path for
166  
167 a given spec file
168  
169 =cut
170  
171 sub _get_path4spec_file {
172  
173 my (@self) = @_;
174  
175 if ( length $dirs->{_file_name} ) {
176  
177 my $file_name = $dirs->{_file_name};
178 my $result;
179  
180 =head2 Collect parameters from local hash
181  
182 =cut
183  
184 my $GRANDPARENT_DIR = $path4SeismicUnixGui;
185 my @PARENT_DIR_SPECS = @{ $dirs->{_PARENT_DIR_SPECS} };
186 my @CHILD_DIR_SPECS = @{ $dirs->{_CHILD_DIR_SPECS} };
187  
188 =head2 Collect relevant "spec"
189  
190 project paths and files
191  
192 =cut
193  
194 my ( $result_aref3, $dimensions_aref ) = _get_specs_pathNfile2search();
195 my @result_aref2 = @$result_aref3;
196 my @directory_contents_specs = @{ $result_aref2[0] };
197 my @dimension = @$dimensions_aref;
198 my $parent_directory_specs_number_of = $dimension[0];
199 my $child_directory_specs_number_of = $dimension[1];
200  
201 # test
202 # my $parent_specs = 1;
203 # my $child_specs = 1;
204 # print(
205 #"\nFor specs directory paths: $PARENT_DIR_SPECS[$parent_specs]::$CHILD_DIR_SPECS[$child_specs]::\n"
206 # );
207 # print("@{$directory_contents_specs[$parent_specs][$child_specs]}\n");
208  
209 =head2 Search all "spec"-relevant
210  
211 directories start with
212 gui drectory listing
213  
214 =cut
215  
216 for (
217 my $parent = 0 ;
218 $parent < $parent_directory_specs_number_of ;
219 $parent++
220 )
221 {
222  
223 for (
224 my $child = 0 ;
225 $child < $child_directory_specs_number_of ;
226 $child++
227 )
228 {
229  
230 my $directory_list_aref =
231 $directory_contents_specs[$parent][$child];
232 my @directory_list = @$directory_list_aref;
233  
234 my $length_directory_list = scalar @directory_list;
235  
236 # print("@{$directory_contents_specs[$parent][$child]}\n");
237 # print("file_name=$file_name\n");
238 for ( my $i = 0 ; $i < $length_directory_list ; $i++ ) {
239  
240 if ( not $file_name eq $directory_list[$i] ) {
241  
242 next;
243  
244 }
245 elsif ( $file_name eq $directory_list[$i] ) {
246  
247 # print(
248 #"dirs,_get_path4spec_file,found the file $file_name in
249 # $PARENT_DIR_SPECS[$parent]::$CHILD_DIR_SPECS[$child]\n"
250 # );
251 $result =
252 $path4SeismicUnixGui . '/'
253 . $PARENT_DIR_SPECS[$parent] . '/'
254 . $CHILD_DIR_SPECS[$child];
255  
256 return ($result);
257 }
258 else {
259 print("change_a_line, unexpected value\n");
260 return ();
261 }
262 }
263  
264 }
265 }
266  
267 }
268 else {
269 print("dirs,__get_path4spec_file,file_name_missing\n");
270 return ();
271 }
272 }
273  
274 =head2 sub _get_path4su_file
275  
276 Find a path for
277  
278 a given spec file
279  
280 =cut
281  
282 sub _get_path4su_file {
283  
284 my (@self) = @_;
285  
286 if ( length $dirs->{_file_name} ) {
287  
288 my $file_name = $dirs->{_file_name};
289 my $result;
290  
291 =head2 Collect parameters from local hash
292  
293 =cut
294  
295 my $GRANDPARENT_DIR = $path4SeismicUnixGui;
296 my @PARENT_DIR_SPECS = @{ $dirs->{_PARENT_DIR_SPECS} };
297 my @CHILD_DIR_SPECS = @{ $dirs->{_CHILD_DIR_SPECS} };
298  
299 =head2 Collect relevant "spec"
300  
301 project paths and files
302  
303 =cut
304  
305 my ( $result_aref3, $dimensions_aref ) = _get_su_pathNfile2search();
306 my @result_aref2 = @$result_aref3;
307 my @directory_contents_su = @{ $result_aref2[0] };
308 my @dimension = @$dimensions_aref;
309 my $parent_directory_su_number_of = $dimension[0];
310 my $child_directory_su_number_of = $dimension[1];
311  
312 # test
313 # my $parent_su = 1;
314 # my $child_su = 1;
315 # print(
316 #"\nFor su directory paths: $PARENT_DIR_SPECS[$parent_su]::$CHILD_DIR_SPECS[$child_su]::\n"
317 # );
318 # print("@{$directory_contents_su[$parent_su][$child_su]}\n");
319  
320 =head2 Search all "spec"-relevant
321  
322 directories start with
323 gui drectory listing
324  
325 =cut
326  
327 for (
328 my $parent = 0 ;
329 $parent < $parent_directory_su_number_of ;
330 $parent++
331 )
332 {
333  
334 for (
335 my $child = 0 ;
336 $child < $child_directory_su_number_of ;
337 $child++
338 )
339 {
340  
341 my $directory_list_aref =
342 $directory_contents_su[$parent][$child];
343 my @directory_list = @$directory_list_aref;
344  
345 my $length_directory_list = scalar @directory_list;
346  
347 # print("@{$directory_contents_su[$parent][$child]}\n");
348 # print("file_name=$file_name\n");
349 for ( my $i = 0 ; $i < $length_directory_list ; $i++ ) {
350  
351 if ( not $file_name eq $directory_list[$i] ) {
352  
353 next;
354  
355 }
356 elsif ( $file_name eq $directory_list[$i] ) {
357  
358 # print(
359 #"dirs,_get_path4spec_file,found the file $file_name in
360 # $PARENT_DIR_SPECS[$parent]::$CHILD_DIR_SPECS[$child]\n"
361 # );
362 $result =
363 $path4SeismicUnixGui . '/'
364 . $PARENT_DIR_SPECS[$parent] . '/'
365 . $CHILD_DIR_SPECS[$child];
366  
367 return ($result);
368 }
369 else {
370 print("change_a_line, unexpected value\n");
371 return ();
372 }
373 }
374  
375 }
376 }
377  
378 }
379 else {
380 print("dirs,__get_path4spec_file,file_name_missing\n");
381 return ();
382 }
383 }
384  
385 sub _set_file_name {
386  
387 my ($self) = @_;
388  
389 if ( length $self ) {
390  
391 $dirs->{_file_name} = $self;
392  
393 # print("dirs,set_file_name,_set_file_name = $dirs->{_file_name}\n");
394  
395 }
396 else {
397 print("dirs,_set_file_name, missing variable");
398 }
399  
400 }
401  
402 =head2 sub get_ls
403  
404 i/p directory
405 o/p array ref of list of file names
406  
407 =cut
408  
409 sub get_ls {
410 my (@self) = @_;
411  
412 my $directory = $dirs->{_DIR};
413 my @list;
414  
415 if ($directory) {
416 opendir( DIR, $directory ) or die $!;
417 my $i = 0;
418 while ( my $file = readdir(DIR) ) {
419  
420 #chomp $file;
421 # Use a regular expression to ignore files beginning with a period
422 next if ( $file =~ m/^\./ );
423  
424 # print "$file\n";
425 $list[$i] = $file;
426 $i++;
427 }
428  
429 # print @list;
430 closedir(DIR);
431 return ( \@list );
432 }
433 else {
434 print("dirs,get_ls,no directory available\n");
435 return ();
436 }
437  
438 }
439  
440 sub get_last_dirInpath {
441  
442 my ($self) = @_;
443 my $result;
444  
445 if ( defined $dirs->{_path}
446 && $dirs->{_path} ne $empty_string )
447 {
448  
449 my @dir = split( /\//, $dirs->{_path} );
450  
451 # print("dirs, get_last_dir, $dir[$#dir] \n");
452 $result = $dir[$#dir];
453 return ($result);
454  
455 }
456 else {
457 print("dirs, get_last_dirInpath, missing a path\n");
458 }
459 }
460  
461 sub set_dir {
462 my ( $self, $DIR ) = @_;
463  
464 if ($DIR) {
465 $dirs->{_DIR} = $DIR;
466  
467 # print("dirs,set_dir, DIR: $dirs->{_DIR}\n");
468 }
469 return ();
470 }
471  
472 sub set_path {
473 my ( $self, $path ) = @_;
474  
475 if ( defined $path
476 && $path ne $empty_string )
477 {
478  
479 $dirs->{_path} = $path;
480 $dirs->{_DIR} = $path;
481  
482 }
483 else {
484 print("dirs,set_path, missing value\n");
485 }
486  
487 return ();
488 }
489  
490 #=head2 sub get_colon_pathNmodule
491 #
492 #=cut
493 #
494 #sub get_colon_pathNmodule {
495 #
496 # my ($self) = @_;
497 #
498 # if ( length $dirs->{_program_name} ) {
499 #
500 # my $program_name = $dirs->{_program_name};
501 #
502 # my $module_spec = $program_name . '_spec';
503 # my $module_spec_pm = $program_name . '_spec.pm';
504 #
505 # _set_file_name($module_spec_pm);
506 # my $path4spec = _get_path4spec_file();
507 #
508 # my $path4SeismicUnixGui = _get_path4SeismicUnixGui;
509 #
510 # # my $pathNmodule_pm = $path4spec . '/' . $module_spec_pm;
511 # my $pathNmodule_spec = $path4spec . '/' . $module_spec;
512 #
513 # # carp"pathNmodule_pm = $pathNmodule_pm";
514 #
515 # $pathNmodule_spec =~ s/$path4SeismicUnixGui//g;
516 # $pathNmodule_spec =~ s/\//::/g;
517 # my $new_pathNmodule_spec = 'App::SeismicUnixGui' . $pathNmodule_spec;
518 #
519 # my $result = $new_pathNmodule_spec;
520 # return ($result);
521 #
522 # }
523 # else {
524 # carp "missing program name";
525 # return ();
526 # }
527 #
528 #}
529 #
530 #=head2 sub get_colon_pathNmodule_spec
531 #
532 #=cut
533 #
534 #sub get_colon_pathNmodule_spec {
535 #
536 # my ($self) = @_;
537 #
538 # if ( length $dirs->{_program_name} ) {
539 #
540 # my $program_name = $dirs->{_program_name};
541 #
542 # my $module_spec = $program_name . '_spec';
543 # my $module_spec_pm = $program_name . '_spec.pm';
544 #
545 # _set_file_name($module_spec_pm);
546 # my $path4spec = _get_path4spec_file();
547 #
548 # my $path4SeismicUnixGui = _get_path4SeismicUnixGui;
549 #
550 # # my $pathNmodule_pm = $path4spec . '/' . $module_spec_pm;
551 # my $pathNmodule_spec = $path4spec . '/' . $module_spec;
552 #
553 # # carp"pathNmodule_pm = $pathNmodule_pm";
554 #
555 # $pathNmodule_spec =~ s/$path4SeismicUnixGui//g;
556 # $pathNmodule_spec =~ s/\//::/g;
557 # my $new_pathNmodule_spec = 'App::SeismicUnixGui' . $pathNmodule_spec;
558 #
559 # my $result = $new_pathNmodule_spec;
560 # return ($result);
561 #
562 # }
563 # else {
564 # carp "missing program name";
565 # return ();
566 # }
567 #
568 #}
569 #
570 #sub get_path4SeismicUnixGui {
571 # my ($self) = @_;
572 # if ( length $path4SeismicUnixGui ) {
573 #
574 # my $result = $path4SeismicUnixGui;
575 # return ($result);
576 #
577 # }
578 # else {
579 # print(
580 # "dirs, get_path4SeismicUnixGui,missing variable\n"
581 # );
582 # }
583 # return ();
584 #}
585 #
586 #=head2 sub get_pathNmodule_spec
587 #
588 #=cut
589 #
590 #sub get_pathNmodule_spec {
591 # my ($self) = @_;
592 #
593 # if ( length $dirs->{_program_name} ) {
594 #
595 # my $program_name = $dirs->{_program_name};
596 # my $module_spec = $program_name . '_spec';
597 # my $module_spec_pm = $module_spec . '.pm';
598 # _set_file_name($module_spec_pm);
599 #
600 # my $path4spec = _get_path4spec_file();
601 #
602 # my $pathNmodule_spec = $path4spec . '/' . $module_spec;
603 #
604 # # carp "pathNmodule_pm = $pathNmodule_pm";
605 # my $result = $pathNmodule_spec;
606 # return ($result);
607 #
608 # }
609 # else {
610 # carp "missing program name";
611 # return ();
612 # }
613 #
614 #}
615 #
616 #=head2 sub get_pathNmodule_spec_pm
617 #
618 #=cut
619 #
620 #sub get_pathNmodule_spec_pm {
621 # my ($self) = @_;
622 #
623 # if ( length $dirs->{_program_name} ) {
624 #
625 # my $program_name = $dirs->{_program_name};
626 # my $module_spec_pm = $program_name . '_spec.pm';
627 # _set_file_name($module_spec_pm);
628 #
629 # my $path4spec = _get_path4spec_file();
630 #
631 # my $pathNmodule_spec_pm = $path4spec . '/' . $module_spec_pm;
632 #
633 # # carp"pathNmodule_pm = $pathNmodule_pm";
634 # my $result = $pathNmodule_spec_pm;
635 # return ($result);
636 #
637 # }
638 # else {
639 # carp "missing program name";
640 # return ();
641 # }
642 #
643 #}
644 #
645  
646 =head2 sub get_colon_pathNmodule
647  
648 =cut
649  
650 sub get_colon_pathNmodule {
651  
652 my ($self) = @_;
653  
654 if ( length $dirs->{_program_name} ) {
655  
656 my $program_name = $dirs->{_program_name};
657  
658 my $module_spec = $program_name . '_spec';
659 my $module_spec_pm = $program_name . '_spec.pm';
660  
661 _set_file_name($module_spec_pm);
662 my $path4spec = _get_path4spec_file();
663  
664 my $path4SeismicUnixGui = _get_path4SeismicUnixGui;
665  
666 # my $pathNmodule_pm = $path4spec . '/' . $module_spec_pm;
667 my $pathNmodule_spec = $path4spec . '/' . $module_spec;
668  
669 # carp"pathNmodule_pm = $pathNmodule_pm";
670  
671 $pathNmodule_spec =~ s/$path4SeismicUnixGui//g;
672 $pathNmodule_spec =~ s/\//::/g;
673 my $new_pathNmodule_spec = 'App::SeismicUnixGui' . $pathNmodule_spec;
674  
675 my $result = $new_pathNmodule_spec;
676 return ($result);
677  
678 }
679 else {
680 carp "missing program name";
681 return ();
682 }
683  
684 }
685  
686 =head2 sub get_colon_pathNmodule_spec
687  
688 =cut
689  
690 sub get_colon_pathNmodule_spec {
691  
692 my ($self) = @_;
693  
694 if ( length $dirs->{_program_name} ) {
695  
696 my $program_name = $dirs->{_program_name};
697  
698 my $module_spec = $program_name . '_spec';
699 my $module_spec_pm = $program_name . '_spec.pm';
700  
701 _set_file_name($module_spec_pm);
702 my $path4spec = _get_path4spec_file();
703  
704 my $path4SeismicUnixGui = _get_path4SeismicUnixGui;
705  
706 # my $pathNmodule_pm = $path4spec . '/' . $module_spec_pm;
707 my $pathNmodule_spec = $path4spec . '/' . $module_spec;
708  
709 # carp"pathNmodule_pm = $pathNmodule_pm";
710  
711 $pathNmodule_spec =~ s/$path4SeismicUnixGui//g;
712 $pathNmodule_spec =~ s/\//::/g;
713 my $new_pathNmodule_spec = 'App::SeismicUnixGui' . $pathNmodule_spec;
714  
715 my $result = $new_pathNmodule_spec;
716 return ($result);
717  
718 }
719 else {
720 carp "missing program name";
721 return ();
722 }
723  
724 }
725  
726 sub get_path4SeismicUnixGui {
727 my ($self) = @_;
728 if ( length $path4SeismicUnixGui ) {
729  
730 my $result = $path4SeismicUnixGui;
731 return ($result);
732  
733 }
734 else {
735 print(
736 "dirs, get_path4SeismicUnixGui,missing variable\n"
737 );
738 }
739 return ();
740 }
741  
742 =head2 sub get_pathNmodule_spec
743  
744 =cut
745  
746 sub get_pathNmodule_spec {
747 my ($self) = @_;
748  
749 if ( length $dirs->{_program_name} ) {
750  
751 my $program_name = $dirs->{_program_name};
752 my $module_spec = $program_name . '_spec';
753 my $module_spec_pm = $module_spec . '.pm';
754 _set_file_name($module_spec_pm);
755  
756 my $path4spec = _get_path4spec_file();
757  
758 my $pathNmodule_spec = $path4spec . '/' . $module_spec;
759  
760 # carp "pathNmodule_pm = $pathNmodule_pm";
761 my $result = $pathNmodule_spec;
762 return ($result);
763  
764 }
765 else {
766 carp "missing program name";
767 return ();
768 }
769  
770 }
771  
772 =head2 sub get_pathNmodule_spec_pm
773  
774 =cut
775  
776 sub get_pathNmodule_spec_pm {
777 my ($self) = @_;
778  
779 if ( length $dirs->{_program_name} ) {
780  
781 my $program_name = $dirs->{_program_name};
782 my $module_spec_pm = $program_name . '_spec.pm';
783 _set_file_name($module_spec_pm);
784  
785 my $path4spec = _get_path4spec_file();
786  
787 my $pathNmodule_spec_pm = $path4spec . '/' . $module_spec_pm;
788  
789 # carp"pathNmodule_pm = $pathNmodule_pm";
790 my $result = $pathNmodule_spec_pm;
791 return ($result);
792  
793 }
794 else {
795 carp "missing program name";
796 return ();
797 }
798  
799 }
800  
801 =head2 sub get_pathNfile2search
802  
803 Useful directories to search
804  
805 =cut
806  
807 sub get_pathNfile2search {
808  
809 my ($self) = @_;
810  
811 if ( length $dirs->{_CHILD_DIR_type}
812 and length $dirs->{_GRANDPARENT_DIR}
813 and length $dirs->{_PARENT_DIR_type} )
814 {
815  
816 my $CHILD_DIR_type = $dirs->{_CHILD_DIR_type};
817 my $GRANDPARENT_DIR = $dirs->{_GRANDPARENT_DIR};
818 my $PARENT_DIR_type = $dirs->{_PARENT_DIR_type};
819
820  
821 =head2 Define
822  
823 variables
824
825 =cut
826  
827 my @directory_contents;
828 my @dimensions;
829  
830 =head2 Define
831  
832 directory search arrays
833
834 =cut
835  
836 # print("dirs,get_pathNfile2search CHILD_DIR = @{$dirs->{$dirs->{_CHILD_DIR_type}}}\n");
837 # print("dirs,get_pathNfile2search PARENT_DIR= @{$dirs->{$dirs->{_PARENT_DIR_type}}}\n");
838
839 my @PARENT_DIR = @{ $dirs->{$dirs->{_PARENT_DIR_type}} };
840 my @CHILD_DIR = @{ $dirs->{$dirs->{_CHILD_DIR_type}} };
841
842 # print("dirs,get_pathNfile2search PARENT_DIR= @PARENT_DIR\n");
843 # print("dirs,get_pathNfile2search CHILD_DIR= @CHILD_DIR\n");
844  
845 my $parent_directory_number_of = scalar @PARENT_DIR;
846 my $child_directory_number_of = scalar @CHILD_DIR;
847  
848 @dimensions =
849 ( $parent_directory_number_of, $child_directory_number_of );
850  
851 =head2 SU-related matters
852  
853 =cut
854  
855 for (
856 my $parent = 0 ;
857 $parent < $parent_directory_number_of ;
858 $parent++
859 )
860 {
861  
862 for (
863 my $child = 0 ;
864 $child < $child_directory_number_of ;
865 $child++
866 )
867 {
868  
869 my $SEARCH_DIR =
870 $GRANDPARENT_DIR . '/'
871 . $PARENT_DIR[$parent] . '/'
872 . $CHILD_DIR[$child];
873  
874 # print(
875 # "dirs, get_pathNfile2search,SEARCH_DIR=$SEARCH_DIR\n"
876 # );
877 $manage_dirs_by->set_directory($SEARCH_DIR);
878 my $directory_list_aref = $manage_dirs_by->get_file_list_aref();
879 my @directory_list = @$directory_list_aref;
880 my $files_number_of = scalar @directory_list;
881 my @pathNfile;
882  
883 for ( my $i = 0 ; $i < $files_number_of ; $i++ ) {
884  
885 $pathNfile[$i] = $SEARCH_DIR . '/' . $directory_list[$i];
886  
887 }
888  
889 $directory_contents[$parent][$child] = \@pathNfile;
890  
891 # print("dirs,get_pathNfile2search,dir contents:@{$directory_contents[$parent][$child]}\n");
892  
893 }
894 }
895  
896 my $result_aref2 = \@directory_contents;
897  
898 return ( $result_aref2, \@dimensions );
899 }
900 else {
901 print("dirs, get_pathNfile2search, missing variable(s)\n");
902 print("CHILD_DIR=$dirs->{_CHILD_DIR}\n");
903 print("GRANDPARENT_DIR=$dirs->{_GRANDPARENT_DIR}\n");
904 print("PARENT_DIR=$dirs->{_PARENT_DIR}\n");
905 }
906  
907 }
908  
909 =head2 sub _get_convert_pathNfile2search
910  
911 Useful directories to search when
912 converting old perl files to new perl
913 files (> 0.7)
914  
915 =cut
916  
917 sub _get_convert_pathNfile2search {
918  
919 my ($self) = @_;
920  
921 =head2 import modules
922  
923 =cut
924  
925 use Carp;
926  
927 =head2 Instantiate modules
928  
929 =cut
930  
931 my $manage_dirs_by = manage_dirs_by->new();
932  
933 =head2 Define
934  
935 variables
936
937 =cut
938  
939 my @result_aref2;
940 my @directory_contents_convert;
941 my @dimensions;
942  
943 =head2 Define
944  
945 directory search arrays
946
947 =cut
948  
949 my $GRANDPARENT_DIR = $path4SeismicUnixGui;
950  
951 # print ("dirs,_get_convert_pathNfile2search,SeismicUnixGui = $path4SeismicUnixGui\n");
952  
953 my @PARENT_DIR_CONVERT = @{ $dirs->{_PARENT_DIR_CONVERT} };
954 my @CHILD_DIR_CONVERT = @{ $dirs->{_CHILD_DIR_CONVERT} };
955  
956 # print("dirs,PARENT_DIR_CONVERT=@PARENT_DIR_CONVERT\n");
957 # print("dirs,CHILD_DIR_CONVERT=@CHILD_DIR_CONVERT\n");
958  
959 my $parent_directory_convert_number_of = scalar @PARENT_DIR_CONVERT;
960 my $child_directory_convert_number_of = scalar @CHILD_DIR_CONVERT;
961  
962 @dimensions = (
963 $parent_directory_convert_number_of,
964 $child_directory_convert_number_of
965 );
966  
967 # $parent_directory_convert_number_of = 2;
968 # $child_directory_convert_number_of = 2;
969  
970 # print("dirs,parent_directory_convert_number_of=$parent_directory_convert_number_of\n");
971 # print("dirs,child_directory_convert_number_of=$child_directory_convert_number_of\n");
972  
973 =head2 CONVERT-related matters first
974  
975 =cut
976  
977 for (
978 my $parent = 0 ;
979 $parent < $parent_directory_convert_number_of ;
980 $parent++
981 )
982 {
983  
984 for (
985 my $child = 0 ;
986 $child < $child_directory_convert_number_of ;
987 $child++
988 )
989 {
990  
991 my $SEARCH_DIR =
992 $GRANDPARENT_DIR . '/'
993 . $PARENT_DIR_CONVERT[$parent] . '/'
994 . $CHILD_DIR_CONVERT[$child];
995  
996 $manage_dirs_by->set_directory($SEARCH_DIR);
997 my $directory_list_aref = $manage_dirs_by->get_file_list_aref();
998  
999 if ( length $directory_list_aref ) {
1000  
1001 $directory_contents_convert[$parent][$child] =
1002 $directory_list_aref;
1003  
1004 # print("dirs,print search_dir = $SEARCH_DIR\n");
1005 # print("dirs,directory_list_aref=@{$directory_list_aref}\n");
1006  
1007 }
1008 else {
1009 # print(
1010 #"dirs, _get_convert_pathNfile2search,missing directory\n"
1011 # );
1012 # print("print search_dir = $SEARCH_DIR\n");
1013 }
1014  
1015 }
1016  
1017 }
1018  
1019 # my $parent_convert = 0;
1020 # my $child_convert = 0;
1021 #
1022 # print(
1023 #"\ndirs, get_pathNfile2search, For convert directory paths: $PARENT_DIR_CONVERT[$parent_convert]::$CHILD_DIR_CONVERT[$child_convert]::\n"
1024 # );
1025 #
1026 # print("@{$directory_contents_convert[$parent_convert][$child_convert]}\n");
1027  
1028 $result_aref2[0] = \@directory_contents_convert;
1029  
1030 return ( \@result_aref2, \@dimensions );
1031  
1032 }
1033  
1034 =head2 sub _get_specs_pathNfile2search
1035  
1036 Useful directories to search
1037  
1038 =cut
1039  
1040 sub _get_specs_pathNfile2search {
1041  
1042 my ($self) = @_;
1043  
1044 =head2 Instantiate modules
1045  
1046 =cut
1047  
1048 my $manage_dirs_by = manage_dirs_by->new();
1049  
1050 =head2 Define
1051  
1052 variables
1053
1054 =cut
1055  
1056 my @result_aref2;
1057 my @directory_contents_specs;
1058 my @dimensions;
1059  
1060 =head2 Define
1061  
1062 directory search arrays
1063
1064 =cut
1065  
1066 my $GRANDPARENT_DIR = $path4SeismicUnixGui;
1067  
1068 my @PARENT_DIR_SPECS = @{ $dirs->{_PARENT_DIR_SPECS} };
1069 my @CHILD_DIR_SPECS = @{ $dirs->{_CHILD_DIR_SPECS} };
1070  
1071 my $parent_directory_specs_number_of = scalar @PARENT_DIR_SPECS;
1072 my $child_directory_specs_number_of = scalar @CHILD_DIR_SPECS;
1073  
1074 @dimensions =
1075 ( $parent_directory_specs_number_of, $child_directory_specs_number_of );
1076  
1077 # print(
1078 # "dirs,$parent_directory_specs_number_of, $child_directory_specs_number_of\n"
1079 # );
1080  
1081 =head2 SPECS-related matters
1082  
1083 =cut
1084  
1085 for (
1086 my $parent = 0 ;
1087 $parent < $parent_directory_specs_number_of ;
1088 $parent++
1089 )
1090 {
1091  
1092 for (
1093 my $child = 0 ;
1094 $child < $child_directory_specs_number_of ;
1095 $child++
1096 )
1097 {
1098  
1099 my $SEARCH_DIR =
1100 $GRANDPARENT_DIR . '/'
1101 . $PARENT_DIR_SPECS[$parent] . '/'
1102 . $CHILD_DIR_SPECS[$child];
1103  
1104 # print(
1105 # "dirs, _get_specs_pathNfile2search,SEARCH_DIR=$SEARCH_DIR\n"
1106 # );
1107 $manage_dirs_by->set_directory($SEARCH_DIR);
1108 my $directory_list_aref = $manage_dirs_by->get_file_list_aref();
1109 my @directory_list = @$directory_list_aref;
1110  
1111 $directory_contents_specs[$parent][$child] = $directory_list_aref;
1112  
1113 # print("@{$directory_contents_specs[$parent][$child]}\n");
1114  
1115 }
1116  
1117 }
1118  
1119 # my $parent_specs = 1;
1120 # my $child_specs = 1;
1121 # print(
1122 #"\ndirs, get_pathNfile2search, For specs directory paths: $PARENT_DIR_GUI[$parent_specs]::$CHILD_DIR_GUI[$child_gui]::\n"
1123 # );
1124 # print("@{$directory_contents_specs[$parent_specs][$child_specs]}\n");
1125  
1126 $result_aref2[0] = \@directory_contents_specs;
1127  
1128 return ( \@result_aref2, \@dimensions );
1129  
1130 }
1131  
1132 =head2 sub _get_tools_pathNfile2search
1133  
1134 Useful directories to search
1135  
1136 =cut
1137  
1138 sub _get_tools_pathNfile2search {
1139  
1140 my ($self) = @_;
1141  
1142 =head2 Instantiate modules
1143  
1144 =cut
1145  
1146 my $manage_dirs_by = manage_dirs_by->new();
1147  
1148 =head2 Define
1149  
1150 variables
1151
1152 =cut
1153  
1154 my @result_aref2;
1155 my @directory_contents_tools;
1156 my @dimensions;
1157  
1158 =head2 Define
1159  
1160 directory search arrays
1161
1162 =cut
1163  
1164 my $GRANDPARENT_DIR = $path4SeismicUnixGui;
1165  
1166 # my @PARENT_DIR_GUI = @{ $dirs->{_PARENT_DIR_GUI} };
1167 # my @CHILD_DIR_GUI = @{ $dirs->{_CHILD_DIR_GUI} };
1168 my @PARENT_DIR_TOOLS = @{ $dirs->{_PARENT_DIR_TOOLS} };
1169 my @CHILD_DIR_TOOLS = @{ $dirs->{_CHILD_DIR_TOOLS} };
1170  
1171 # my @PARENT_DIR_SU = @{ $dirs->{_PARENT_DIR_SU} };
1172 # my @CHILD_DIR_SU = @{ $dirs->{_CHILD_DIR_SU} };
1173 # my @PARENT_DIR_GEN = @{ $dirs->{_PARENT_DIR_GEN} };
1174  
1175 # print("PARENT_DIR_GUI=@PARENT_DIR_GUI\n");
1176  
1177 # my $parent_directory_gui_number_of = scalar @PARENT_DIR_GUI;
1178 # my $child_directory_gui_number_of = scalar @CHILD_DIR_GUI;
1179 my $parent_directory_tools_number_of = scalar @PARENT_DIR_TOOLS;
1180 my $child_directory_tools_number_of = scalar @CHILD_DIR_TOOLS;
1181  
1182 # my $parent_directory_su_number_of = scalar @PARENT_DIR_SU;
1183 # my $child_directory_su_number_of = scalar @CHILD_DIR_SU;
1184 # my $parent_directory_gen_number_of = scalar @PARENT_DIR_GEN;
1185  
1186 @dimensions =
1187 ( $parent_directory_tools_number_of, $child_directory_tools_number_of );
1188  
1189 # $parent_directory_su_number_of, $child_directory_su_number_of,
1190 # $parent_directory_gen_number_of $parent_directory_gui_number_of,
1191 # $child_directory_gui_number_of,
1192  
1193 =head2 TOOLS-related matters first
1194  
1195 =cut
1196  
1197 for (
1198 my $parent = 0 ;
1199 $parent < $parent_directory_tools_number_of ;
1200 $parent++
1201 )
1202 {
1203  
1204 for (
1205 my $child = 0 ;
1206 $child < $child_directory_tools_number_of ;
1207 $child++
1208 )
1209 {
1210  
1211 my $SEARCH_DIR =
1212 $GRANDPARENT_DIR . '/'
1213 . $PARENT_DIR_TOOLS[$parent] . '/'
1214 . $CHILD_DIR_TOOLS[$child];
1215  
1216 # print(
1217 # "dirs, _get_tools_pathNfile2search,SEARCH_DIR=$SEARCH_DIR\n"
1218 # );
1219 $manage_dirs_by->set_directory($SEARCH_DIR);
1220 my $directory_list_aref = $manage_dirs_by->get_file_list_aref();
1221 my @directory_list = @$directory_list_aref;
1222  
1223 $directory_contents_tools[$parent][$child] = $directory_list_aref;
1224  
1225 # print("@{$directory_contents_TOOLS[$parent][$child]}\n");
1226  
1227 }
1228  
1229 }
1230  
1231 # my $parent_TOOLS = 1;
1232 # my $child_TOOLS = 1;
1233 # print(
1234 #"\ndirs, get_tools_pathNfile2search, For TOOLS directory paths: $PARENT_DIR_TOOLS[$parent_TOOLS]::$CHILD_DIR_TOOLS[$child_tools]::\n"
1235 # );
1236 # print("@{$directory_contents_tools[$parent_tools][$child_tools]}\n");
1237  
1238 $result_aref2[0] = \@directory_contents_tools;
1239  
1240 return ( \@result_aref2, \@dimensions );
1241  
1242 }
1243  
1244 =head2 Find a path for
1245  
1246 a given perl file
1247 generated by the convert
1248  
1249 =cut
1250  
1251 sub get_path4convert_file {
1252  
1253 my (@self) = @_;
1254  
1255 if ( length $dirs->{_file_name} ) {
1256  
1257 my $file_name = $dirs->{_file_name};
1258 my $result;
1259  
1260 =head2 Collect parameters from local hash
1261  
1262 =cut
1263  
1264 my $GRANDPARENT_DIR = $path4SeismicUnixGui;
1265 my @PARENT_DIR_CONVERT = @{ $dirs->{_PARENT_DIR_CONVERT} };
1266 my @CHILD_DIR_CONVERT = @{ $dirs->{_CHILD_DIR_CONVERT} };
1267  
1268 =head2 Collect relevant "convert"
1269  
1270 project paths and files
1271  
1272 =cut
1273  
1274 my ( $result_aref3, $dimensions_aref ) =
1275 _get_convert_pathNfile2search();
1276 my @result_aref2 = @$result_aref3;
1277 my @directory_contents_convert = @{ $result_aref2[0] };
1278 my @dimension = @$dimensions_aref;
1279 my $parent_directory_convert_number_of = $dimension[0];
1280 my $child_directory_convert_number_of = $dimension[1];
1281  
1282 # test
1283 # my $parent_convert = 0;
1284 # my $child_convert = 0;
1285 # print(
1286 #"\ndirs,get_path4convert_file, For convert directory paths: App::SeismicUnixGui::$PARENT_DIR_CONVERT[$parent_convert]::$CHILD_DIR_CONVERT[$child_convert]\n"
1287 # );
1288 # print(
1289 # "_SU_global_constants,get_path4convert_file,@{$directory_contents_convert[$parent_convert][$child_convert]}\n"
1290 # );
1291  
1292 =head2 Search all "convert"-relevant
1293  
1294 directories start with
1295 convert derectory listing
1296  
1297 =cut
1298  
1299 for (
1300 my $parent = 0 ;
1301 $parent < $parent_directory_convert_number_of ;
1302 $parent++
1303 )
1304 {
1305  
1306 for (
1307 my $child = 0 ;
1308 $child < $child_directory_convert_number_of ;
1309 $child++
1310 )
1311 {
1312  
1313 my $directory_list_aref =
1314 $directory_contents_convert[$parent][$child];
1315  
1316 if ( length $directory_list_aref ) {
1317  
1318 my @directory_list = @$directory_list_aref;
1319 my $length_directory_list = scalar @directory_list;
1320  
1321 # print(
1322 #"L_SU_global_contents,@{$directory_contents_convert[$parent][$child]}\n"
1323 # );
1324 # print("L_SU_global_contents,file_name=$file_name\n");
1325  
1326 for ( my $i = 0 ; $i < $length_directory_list ; $i++ ) {
1327  
1328 # print("dirs, directory list=$directory_list[$i]\n");
1329 ;
1330 if ( not $file_name eq $directory_list[$i] ) {
1331  
1332 next;
1333  
1334 }
1335 elsif ( $file_name eq $directory_list[$i] ) {
1336  
1337 # print(
1338 #"dirs,get_path4convert_file,found the file $file_name in
1339 # $PARENT_DIR_CONVERT[$parent]::$CHILD_DIR_CONVERT[$child]\n"
1340 # );
1341 $result =
1342 $path4SeismicUnixGui . '/'
1343 . $PARENT_DIR_CONVERT[$parent] . '/'
1344 . $CHILD_DIR_CONVERT[$child];
1345  
1346 return ($result);
1347 }
1348 else {
1349 print("change_a_line, unexpected value\n");
1350 return ();
1351 }
1352 }
1353  
1354 }
1355 else {
1356 # print(
1357 # "dirs, get_path4convert_file, missing directory; NADA\n"
1358 # );
1359 }
1360  
1361 }
1362 }
1363  
1364 }
1365 else {
1366 print(
1367 "dirs,_get_path_4convert_file,file_name_missing\n"
1368 );
1369 return ();
1370 }
1371 }
1372  
1373 =head2 sub get_path4spec_file
1374  
1375 Find a path for
1376  
1377 a given spec file
1378  
1379 =cut
1380  
1381 sub get_path4spec_file {
1382  
1383 my (@self) = @_;
1384  
1385 if ( length $dirs->{_file_name} ) {
1386  
1387 my $file_name = $dirs->{_file_name};
1388 my $result;
1389  
1390 =head2 Collect parameters from local hash
1391  
1392 =cut
1393  
1394 my $GRANDPARENT_DIR = $path4SeismicUnixGui;
1395 my @PARENT_DIR_SPECS = @{ $dirs->{_PARENT_DIR_SPECS} };
1396 my @CHILD_DIR_SPECS = @{ $dirs->{_CHILD_DIR_SPECS} };
1397  
1398 =head2 Collect relevant "spec"
1399  
1400 project paths and files
1401  
1402 =cut
1403  
1404 my ( $result_aref3, $dimensions_aref ) = _get_specs_pathNfile2search();
1405 my @result_aref2 = @$result_aref3;
1406 my @directory_contents_specs = @{ $result_aref2[0] };
1407 my @dimension = @$dimensions_aref;
1408 my $parent_directory_specs_number_of = $dimension[0];
1409 my $child_directory_specs_number_of = $dimension[1];
1410  
1411 # test
1412 # my $parent_specs = 1;
1413 # my $child_specs = 1;
1414 # print(
1415 #"\nFor specs directory paths: $PARENT_DIR_SPECS[$parent_specs]::$CHILD_DIR_SPECS[$child_specs]::\n"
1416 # );
1417 # print("@{$directory_contents_specs[$parent_specs][$child_specs]}\n");
1418  
1419 =head2 Search all "spec"-relevant
1420  
1421 directories start with
1422 gui drectory listing
1423  
1424 =cut
1425  
1426 for (
1427 my $parent = 0 ;
1428 $parent < $parent_directory_specs_number_of ;
1429 $parent++
1430 )
1431 {
1432  
1433 for (
1434 my $child = 0 ;
1435 $child < $child_directory_specs_number_of ;
1436 $child++
1437 )
1438 {
1439  
1440 my $directory_list_aref =
1441 $directory_contents_specs[$parent][$child];
1442 my @directory_list = @$directory_list_aref;
1443  
1444 my $length_directory_list = scalar @directory_list;
1445  
1446 # print("@{$directory_contents_specs[$parent][$child]}\n");
1447 # print("file_name=$file_name\n");
1448 for ( my $i = 0 ; $i < $length_directory_list ; $i++ ) {
1449  
1450 if ( not $file_name eq $directory_list[$i] ) {
1451  
1452 next;
1453  
1454 }
1455 elsif ( $file_name eq $directory_list[$i] ) {
1456  
1457 # print(
1458 #"dirs,get_path4spec_file,found the file $file_name in
1459 # $PARENT_DIR_SPECS[$parent]::$CHILD_DIR_SPECS[$child]\n"
1460 # );
1461 $result =
1462 $path4SeismicUnixGui . '/'
1463 . $PARENT_DIR_SPECS[$parent] . '/'
1464 . $CHILD_DIR_SPECS[$child];
1465  
1466 return ($result);
1467 }
1468 else {
1469 print("change_a_line, unexpected value\n");
1470 return ();
1471 }
1472 }
1473  
1474 }
1475 }
1476  
1477 }
1478 else {
1479 print("dirs,_get_path4spec_file,file_name_missing\n");
1480 return ();
1481 }
1482 }
1483  
1484 =head2 Find a path for
1485  
1486 a given tools file
1487 You need to pre-determine
1488 you have a "Tools" file
1489  
1490 =cut
1491  
1492 sub get_path4tools_file {
1493  
1494 my (@self) = @_;
1495  
1496 if ( length $dirs->{_file_name} ) {
1497  
1498 my $file_name = $dirs->{_file_name};
1499 my $result;
1500  
1501 =head2 Collect parameters from local hash
1502  
1503 =cut
1504  
1505 my $GRANDPARENT_DIR = $path4SeismicUnixGui;
1506 my @PARENT_DIR_TOOLS = @{ $dirs->{_PARENT_DIR_TOOLS} };
1507 my @CHILD_DIR_TOOLS = @{ $dirs->{_CHILD_DIR_TOOLS} };
1508  
1509 =head2 Collect relevant "tools"
1510  
1511 project paths and files
1512  
1513 =cut
1514  
1515 my ( $result_aref3, $dimensions_aref ) = _get_tools_pathNfile2search();
1516 my @result_aref2 = @$result_aref3;
1517 my @directory_contents_tools = @{ $result_aref2[0] };
1518 my @dimension = @$dimensions_aref;
1519 my $parent_directory_tools_number_of = $dimension[0];
1520 my $child_directory_tools_number_of = $dimension[1];
1521  
1522 # test
1523 # my $parent_tools = 1;
1524 # my $child_tools = 1;
1525 # print(
1526 #"\nFor tools directory paths: $PARENT_DIR_TOOLS[$parent_tools]::$CHILD_DIR_TOOLS[$child_tools]::\n"
1527 # );
1528 # print("@{$directory_contents_tools[$parent_tools][$child_tools]}\n");
1529  
1530 =head2 Search all "spec"-relevant
1531  
1532 directories start with
1533 gui drectory listing
1534  
1535 =cut
1536  
1537 for (
1538 my $parent = 0 ;
1539 $parent < $parent_directory_tools_number_of ;
1540 $parent++
1541 )
1542 {
1543  
1544 for (
1545 my $child = 0 ;
1546 $child < $child_directory_tools_number_of ;
1547 $child++
1548 )
1549 {
1550  
1551 my $directory_list_aref =
1552 $directory_contents_tools[$parent][$child];
1553 my @directory_list = @$directory_list_aref;
1554  
1555 my $length_directory_list = scalar @directory_list;
1556  
1557 # print("@{$directory_contents_tools[$parent][$child]}\n");
1558 # print("file_name=$file_name\n");
1559 for ( my $i = 0 ; $i < $length_directory_list ; $i++ ) {
1560  
1561 if ( not $file_name eq $directory_list[$i] ) {
1562  
1563 next;
1564  
1565 }
1566 elsif ( $file_name eq $directory_list[$i] ) {
1567  
1568 # print(
1569 #"dirs,get_path4tools_file,found the file $file_name in
1570 # $PARENT_DIR_TOOLS[$parent]::$CHILD_DIR_TOOLS[$child]\n"
1571 # );
1572 $result =
1573 $path4SeismicUnixGui . '/'
1574 . $PARENT_DIR_TOOLS[$parent] . '/'
1575 . $CHILD_DIR_TOOLS[$child];
1576  
1577 return ($result);
1578 }
1579 else {
1580 print("change_a_line, unexpected value\n");
1581 return ();
1582 }
1583 }
1584  
1585 }
1586 }
1587  
1588 }
1589 else {
1590 print("dirs,_get_path4tools_file,file_name_missing\n");
1591 return ();
1592 }
1593 }
1594  
1595 sub set_file_name {
1596  
1597 my ( $self, $file_name ) = @_;
1598  
1599 if ( length $file_name ) {
1600  
1601 $dirs->{_file_name} = $file_name;
1602  
1603 # print("dirs,set_file_name,set_file_name = $dirs->{_file_name}\n");
1604  
1605 }
1606 else {
1607 print("dirs,set_file_name,missing variable");
1608 }
1609  
1610 }
1611  
1612 =head2 sub set_CHILD_DIR_type
1613  
1614 =cut
1615  
1616 sub set_CHILD_DIR_type {
1617  
1618 my ( $self, $type ) = @_;
1619  
1620 if ( length $type ) {
1621  
1622 $dirs->{_CHILD_DIR_type} = '_CHILD_DIR_' . $type;
1623 # print("dirs,set_CHILD_DIR_type = $dirs->{_CHILD_DIR_type}\n");
1624  
1625 }
1626 else {
1627 print(
1628 "dirs,set_CHILD_DIR_type, type=$type is missing variable"
1629 );
1630 }
1631  
1632 }
1633  
1634 =head2 sub set_GRANDPARENT_DIR
1635  
1636 =cut
1637  
1638 sub set_GRANDPARENT_DIR {
1639  
1640 my ( $self, $GRANDPARENT_DIR ) = @_;
1641  
1642 if ( length $GRANDPARENT_DIR ) {
1643  
1644 $dirs->{_GRANDPARENT_DIR} = $GRANDPARENT_DIR;
1645  
1646 # print("dirs,set_GRANDPARENT_DIR = $dirs->{_GRANDPARENT_DIR}\n");
1647  
1648 }
1649 else {
1650 print("dirs,set_GRANDPARENT_DIR,missing variable");
1651 }
1652  
1653 }
1654  
1655 =head2 sub set_PARENT_DIR_type
1656  
1657 =cut
1658  
1659 sub set_PARENT_DIR_type {
1660  
1661 my ( $self, $type ) = @_;
1662  
1663 if ( length $type ) {
1664  
1665 $dirs->{_PARENT_DIR_type} ='_PARENT_DIR_' . $type;
1666  
1667 # print("dirs,set_PARENT_DIR_type = $dirs->{_PARENT_DIR_type}\n");
1668  
1669 }
1670 else {
1671 print(
1672 "dirs,set_PARENT_DIR_type, type=$type is missing variable"
1673 );
1674 }
1675  
1676 }
1677  
1678 =head2 sub set_program_name
1679  
1680 =cut
1681  
1682 sub set_program_name {
1683  
1684 my ( $self, $program_name ) = @_;
1685  
1686 if ( length $program_name ) {
1687  
1688 $L_SU_global_constants->{_program_name} = $program_name;
1689  
1690 }
1691 else {
1692 carp "missing program_name";
1693 print("dirs,set_program_name,missing program_name\n");
1694 }
1695  
1696 }
1697  
1698 1;