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

filter: Statementstmt 0.0% 0 / 53 Branchbran 0.0% 0 / 26 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 9 Podpod 0.0% 0 / 7 totaltotal 0.0% 0 / 95 CC 14 SCAR 34.3
CC
14
Cov
0%
_program_name
72.0
_sunix
12.0
_superflows
12.0
CRAP 30.9
1 package App::SeismicUnixGui::misc::help;
2  
3 use Moose;
4 our $VERSION = '0.0.1';
5  
6 =head1 DOCUMENTATION
7  
8 =head2 SYNOPSIS
9  
10 Perl package: help.pm
11 AUTHOR: Juan Lorenzo
12 DATE: July 30 2017
13  
14 DESCRIPTION:
15 V 0.1
16 user help
17  
18 USED FOR:
19  
20 BASED ON:
21  
22 =cut
23  
24 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
25 my $set = L_SU_global_constants->new();
26 my $alias = $set->alias_superflow_names_h;
27  
28 my $get = L_SU_global_constants->new();
29 my $var = $get->var();
30 my $superflow_names = $get->superflow_names_h();
31  
32 my $true = $var->{_true};
33 my $false = $var->{_false};
34  
35 =pod
36  
37 private hash_ref
38 w for widgets
39  
40 =cut
41  
42 my $help = {
43 _all_href => '',
44 _program_name_sref => '',
45 _is_flow => $false,
46 _is_superflow => $false,
47 };
48  
49 =head2 TODO
50  
51 determine whether it is a flow or a superflow
52  
53 =cut
54  
55 sub is_superflow {
56  
57 }
58  
59 sub is_flow {
60  
61 }
62  
63 =head2 sub set_name
64  
65 read in initial program name
66  
67 =cut
68  
69 sub set_name {
70 my ( $self, $name_sref ) = @_;
71  
72 if ($name_sref) {
73 $help->{_program_name_sref} = $name_sref;
74  
75 # print("help, set_name, ${$help->{_program_name_sref}}\n");
76  
77 }
78 else {
79 print("help, set_name, missing name\n");
80 }
81 return ();
82  
83 }
84  
85 =head2 sub _program_name
86  
87 i/p is scalar ref
88 o/p is scalar ref
89 print("help, program_name,:$alias->{ProjectVariables}\n");
90 print("help, program_name,is $$program_name_sref\n");
91 print("help, program_name,is ${$help->{_program_name_sref}}\n");
92  
93  
94 =cut
95  
96 sub _program_name {
97 my ($program_name_sref) = @_;
98 if ($program_name_sref) {
99 my $name_sref;
100  
101 #print("1. help, program_name, $$program_name_sref\n");
102  
103 if ( $$program_name_sref eq $superflow_names->{_fk} ) {
104 $name_sref = \$alias->{fk};
105 }
106  
107 if ( $$program_name_sref eq $superflow_names->{_iBottomMute} ) {
108 $name_sref = \$alias->{iBottomMute};
109 }
110  
111 if ( $$program_name_sref eq $superflow_names->{_iSpectralAnalysis} ) {
112 $name_sref = \$alias->{iSpectralAnalysis};
113 }
114  
115 if ( $$program_name_sref eq $superflow_names->{_iTopMute} ) {
116 $name_sref = \$alias->{iTopMute};
117 }
118  
119 if ( $$program_name_sref eq $superflow_names->{_iVelAnalysis} ) {
120 $name_sref = \$alias->{iVelAnalysis};
121 }
122  
123 if ( $$program_name_sref eq $superflow_names->{_ProjectVariables} ) {
124 $name_sref = \$alias->{SetProject};
125 }
126  
127 $help->{_program_name_sref} = $name_sref;
128  
129 #print("2. help, program_name, ${$help->{_program_name_sref}}\n");
130 }
131 return ();
132 }
133  
134 =head2 sub _sunix
135  
136 check if a pure sunix program
137  
138 =cut
139  
140 sub _sunix {
141  
142 my ( $self, $hash_ref ) = @_;
143  
144 if ($hash_ref) {
145 if ( $hash_ref == $true ) {
146
147 $help->{_program_name_sref} = $help->{_program_name_sref};
148  
149 # print("help, sunix, ${$help->{_program_name_sref}}\n");
150 }
151 return ();
152 }
153  
154 }
155  
156 =head2 sub tkpod
157  
158 read perldoc of each program
159  
160 =cut
161  
162 sub tkpod {
163  
164 my ($self) = @_;
165  
166 if ( ${ $help->{_program_name_sref} } ) {
167  
168 # print("help, tkpod, ${$help->{_program_name_sref}}\n");
169 system("tkpod ${$help->{_program_name_sref}} &\n\n");
170  
171 }
172 else {
173 print("help, tkpod, missing program name\n");
174 }
175 return ();
176  
177 }
178  
179 =head2 sub _superflows
180  
181 check if a superflows program
182  
183 =cut
184  
185 sub _superflows {
186  
187 my ( $self, $hash_ref ) = @_;
188  
189 if ($hash_ref) {
190 if ( $hash_ref == $true ) {
191
192 program_name( $help->{_program_name_sref} );
193  
194 # print("help, superflows, ${$help->{_program_name_sref}}\n");
195 }
196 return ();
197 }
198  
199 }
200  
201 1;