lib/App/SeismicUnixGui/sunix/header/sucliphead.pm untested

filter: Statementstmt 0.0% 0 / 56 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 7 totaltotal 0.0% 0 / 80 CC 4 SCAR 13.1
CC
4
Cov
0%
key
6.0
max
6.0
min
6.0
CRAP 3.7
1 package App::SeismicUnixGui::sunix::header::sucliphead;
2  
3 =head2 SYNOPSIS
4  
5 PERL PROGRAM NAME:
6  
7 AUTHOR: Juan Lorenzo (Perl module only)
8  
9 DATE:
10  
11 DESCRIPTION:
12  
13 Version:
14  
15 =head2 USE
16  
17 =head3 NOTES
18  
19 =head4 Examples
20  
21 =head2 SYNOPSIS
22  
23 =head3 SEISMIC UNIX NOTES
24 SUCLIPHEAD - Clip header values
25  
26  
27  
28 sucliphead <stdin >stdout [optional parameters]
29  
30  
31  
32 Required parameters:
33  
34 none
35  
36  
37  
38 Optional parameters:
39  
40 key=cdp,... header key word(s) to clip
41  
42 min=0,... minimum value to clip
43  
44 max=ULONG_MAX,ULONG_MAX,... maximum value to clip
45  
46  
47  
48  
49  
50  
51  
52 Credits:
53  
54 Geocon: Garry Perratt
55  
56  
57  
58  
59  
60 =head2 User's notes (Juan Lorenzo)
61 untested
62  
63 =cut
64  
65  
66 =head2 CHANGES and their DATES
67  
68 =cut
69  
70 use Moose;
71 our $VERSION = '0.0.1';
72  
73  
74 =head2 Import packages
75  
76 =cut
77  
78 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
79  
80 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
81 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
82  
83  
84 =head2 instantiation of packages
85  
86 =cut
87  
88 my $get = L_SU_global_constants->new();
89 my $Project = Project_config->new();
90 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
91 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
92 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
93  
94 my $PS_SEISMIC = $Project->PS_SEISMIC();
95  
96 my $var = $get->var();
97 my $on = $var->{_on};
98 my $off = $var->{_off};
99 my $true = $var->{_true};
100 my $false = $var->{_false};
101 my $empty_string = $var->{_empty_string};
102  
103 =head2 Encapsulated
104 hash of private variables
105  
106 =cut
107  
108 my $sucliphead = {
109 _key => '',
110 _max => '',
111 _min => '',
112 _Step => '',
113 _note => '',
114  
115 };
116  
117 =head2 sub Step
118  
119 collects switches and assembles bash instructions
120 by adding the program name
121  
122 =cut
123  
124 sub Step {
125  
126 $sucliphead->{_Step} = 'sucliphead'.$sucliphead->{_Step};
127 return ( $sucliphead->{_Step} );
128  
129 }
130  
131  
132 =head2 sub note
133  
134 collects switches and assembles bash instructions
135 by adding the program name
136  
137 =cut
138  
139 sub note {
140  
141 $sucliphead->{_note} = 'sucliphead'.$sucliphead->{_note};
142 return ( $sucliphead->{_note} );
143  
144 }
145  
146  
147  
148 =head2 sub clear
149  
150 =cut
151  
152 sub clear {
153  
154 $sucliphead->{_key} = '';
155 $sucliphead->{_max} = '';
156 $sucliphead->{_min} = '';
157 $sucliphead->{_Step} = '';
158 $sucliphead->{_note} = '';
159 }
160  
161  
162 =head2 sub key
163  
164  
165 =cut
166  
167 sub key {
168  
169 my ( $self,$key ) = @_;
170 if ( $key ne $empty_string ) {
171  
172 $sucliphead->{_key} = $key;
173 $sucliphead->{_note} = $sucliphead->{_note}.' key='.$sucliphead->{_key};
174 $sucliphead->{_Step} = $sucliphead->{_Step}.' key='.$sucliphead->{_key};
175  
176 } else {
177 print("sucliphead, key, missing key,\n");
178 }
179 }
180  
181  
182 =head2 sub max
183  
184  
185 =cut
186  
187 sub max {
188  
189 my ( $self,$max ) = @_;
190 if ( $max ne $empty_string ) {
191  
192 $sucliphead->{_max} = $max;
193 $sucliphead->{_note} = $sucliphead->{_note}.' max='.$sucliphead->{_max};
194 $sucliphead->{_Step} = $sucliphead->{_Step}.' max='.$sucliphead->{_max};
195  
196 } else {
197 print("sucliphead, max, missing max,\n");
198 }
199 }
200  
201  
202 =head2 sub min
203  
204  
205 =cut
206  
207 sub min {
208  
209 my ( $self,$min ) = @_;
210 if ( $min ne $empty_string ) {
211  
212 $sucliphead->{_min} = $min;
213 $sucliphead->{_note} = $sucliphead->{_note}.' min='.$sucliphead->{_min};
214 $sucliphead->{_Step} = $sucliphead->{_Step}.' min='.$sucliphead->{_min};
215  
216 } else {
217 print("sucliphead, min, missing min,\n");
218 }
219 }
220  
221  
222 =head2 sub get_max_index
223  
224 max index = number of input variables -1
225
226 =cut
227
228 sub get_max_index {
229 my ($self) = @_;
230 my $max_index = 2;
231  
232 return($max_index);
233 }
234
235
236 1;