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

filter: Statementstmt 0.0% 0 / 38 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 5 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 60 CC 8 SCAR 28.2
CC
8
Cov
0%
help
30.0
change_config
12.0
change_pl
6.0
CRAP 16.8
1 package App::SeismicUnixGui::misc::name;
2  
3 # NOTE TODO will be deprecated in favor of program_name which self-defines
4 # global constants and uses hregex and ashes for quick searbch
5  
6 use Moose;
7 our $VERSION = '0.0.1';
8 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
9  
10 my $get = L_SU_global_constants->new();
11  
12 my $superflow_names_aref = $get->superflow_names_aref();
13 my @superflow_names_aref = @$superflow_names_aref;
14  
15 #my $alias_superflow_names_aref = $get->alias_superflow_names_aref;
16 #my @alias_superflow_names_aref = @$alias_superflow_names_aref;
17  
18 my $alias_superflow_config_names_aref = $get->alias_superflow_config_names_aref;
19 my @alias_superflow_config_names_aref = @$alias_superflow_config_names_aref;
20  
21 my $superflow_config_names_aref = $get->superflow_config_names_aref;
22 my @superflow_config_names_aref = @$superflow_config_names_aref;
23  
24 my $name = {
25  
26 _program_name_config => '',
27 _program_name => '',
28  
29 };
30  
31 #=head2 sub alias_superflow_names
32 #
33 #=cut
34 #
35 #sub get_alias_superflow_names {
36 # my ( $self, $name_in ) = @_;
37 # my $name_out;
38 # my $length = scalar(@alias_superflow_names_aref);
39 #
40 # for ( my $i = 0 ; $i < $length ; $i++ ) {
41 #
42 # print("1. name,get_alias_superflow_names,name_in=$$name_in\n");
43 ## print("1. name,get_alias_superflow_names, alias= $alias_superflow_names_aref[$i]\n");
44 # print("1. name,get_alias_superflow_names, superflow_names= $superflow_names_aref[$i]\n");
45 #
46 # if ( $$name_in eq $superflow_names_aref[$i] ) {
47 #
48 # # print("2. name,get_alias_superflow_names,name_in= $$name_in\n");
49 # $name_out = $alias_superflow_names_aref[$i];
50 #
51 # print("2. name,get_alias_superflow_names, alias= $name_out\n");
52 # }
53 # }
54 # return ($name_out);
55 #}
56  
57 =head2 sub change_config
58  
59 Modify input names--
60 adapt them to infer
61 which spec and parameter
62 files to read
63 CAUSE: aliases in GUI
64 Program names in GUI
65 and configuration file names
66 in the local (!!) directory
67 may be different.
68  
69 =cut
70  
71 sub change_config {
72 my ( $self, $program_name ) = @_;
73  
74 if ($program_name) {
75  
76 # print("name,change_config,progr name is $program_name\n");
77 my $length = scalar @superflow_config_names_aref;
78  
79 # print("name,change_config,length = $length\n");
80  
81 for ( my $i = 0 ; $i < $length ; $i++ ) {
82
83 # print("name,change_config, superflow_config_names_aref[$i]=$superflow_config_names_aref[$i]\n");
84 if ( $program_name eq $superflow_config_names_aref[$i] ) {
85  
86 $name->{_program_name_config} =
87 $alias_superflow_config_names_aref[$i] . '.config';
88  
89 # print ("name,change_config,progr name config is $name->{_program_name_config}\n");
90 }
91 }
92 return ( $name->{_program_name_config} );
93 }
94 }
95  
96 =head2 sub change_pl
97  
98 Modify names--
99 adapt them to infer a ".pl" file
100  
101 =cut
102  
103 sub change_pl {
104 my ( $self, $program_name ) = @_;
105 my $program_name_pl;
106 if ($program_name) {
107  
108 # print("name,change_pl,progr name is $program_name\n");
109 $program_name_pl = $program_name . '.pl';
110  
111 # print("name,change_pl,progr name config is
112 # $name->{_program_name_pl}\n");
113 }
114 return ($program_name_pl);
115 }
116  
117 =head2 sub perldoc names IS this used?
118  
119  
120 =cut
121  
122 sub help { #TODO? needed?
123 my ( $self, $program_name ) = @_;
124 if ( defined($program_name) ) {
125  
126 $name->{_program_name} = $program_name . '.pm';
127  
128 if ( $program_name eq 'SetProject' ) {
129 $name->{_program_name} = 'SetProject';
130 }
131 elsif ( $program_name eq 'fk' ) {
132 $name->{_program_name} = 'Sudipfilt2';
133 }
134 elsif ( $program_name eq 'iVA2' ) {
135 $name->{_program_nameg} = 'iVA2.pm';
136 }
137 }
138 return ( $name->{_program_name} );
139  
140 }
141  
142 1;