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

filter: Statementstmt 0.0% 0 / 49 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 69 CC 3 SCAR 12.0
CC
3
Cov
0%
key
6.0
verbose
6.0
Step
2.0
CRAP 3.3
1 package App::SeismicUnixGui::sunix::header::sukeycount;
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 SUKEYCOUNT - sukeycount writes a count of a selected key
25  
26  
27  
28 sukeycount key=keyword < infile [> outfile]
29  
30  
31  
32 Required parameters:
33  
34 key=keyword One key word.
35  
36  
37  
38 Optional parameters:
39  
40 verbose=0 quiet
41  
42 =1 chatty
43  
44  
45  
46 Writes the key and the count to the terminal or a text
47  
48 file when a change of key occurs. This does not provide
49  
50 a unique key count (see SUCOUNTKEY for that).
51  
52 Note that for key values 1 2 3 4 2 5
53  
54 value 2 is counted once per occurrence since this program
55  
56 only recognizes a change of key, not total occurrence.
57  
58  
59  
60 Examples:
61  
62 sukeycount < stdin key=fldr
63  
64 sukeycount < stdin key=fldr > out.txt
65  
66  
67  
68  
69  
70 Credits:
71  
72  
73  
74 MTU: David Forel, Jan 2005
75  
76  
77  
78 =head2 User's notes (Juan Lorenzo)
79 untested
80  
81 =cut
82  
83  
84 =head2 CHANGES and their DATES
85  
86 =cut
87  
88 use Moose;
89 our $VERSION = '0.0.1';
90  
91  
92 =head2 Import packages
93  
94 =cut
95  
96 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
97  
98 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
99 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
100  
101  
102 =head2 instantiation of packages
103  
104 =cut
105  
106 my $get = L_SU_global_constants->new();
107 my $Project = Project_config->new();
108 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
109 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
110 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
111  
112 my $PS_SEISMIC = $Project->PS_SEISMIC();
113  
114 my $var = $get->var();
115 my $on = $var->{_on};
116 my $off = $var->{_off};
117 my $true = $var->{_true};
118 my $false = $var->{_false};
119 my $empty_string = $var->{_empty_string};
120  
121 =head2 Encapsulated
122 hash of private variables
123  
124 =cut
125  
126 my $sukeycount = {
127 _key => '',
128 _verbose => '',
129 _Step => '',
130 _note => '',
131  
132 };
133  
134 =head2 sub Step
135  
136 collects switches and assembles bash instructions
137 by adding the program name
138  
139 =cut
140  
141 sub Step {
142  
143 $sukeycount->{_Step} = 'sukeycount'.$sukeycount->{_Step};
144 return ( $sukeycount->{_Step} );
145  
146 }
147  
148  
149 =head2 sub note
150  
151 collects switches and assembles bash instructions
152 by adding the program name
153  
154 =cut
155  
156 sub note {
157  
158 $sukeycount->{_note} = 'sukeycount'.$sukeycount->{_note};
159 return ( $sukeycount->{_note} );
160  
161 }
162  
163  
164  
165 =head2 sub clear
166  
167 =cut
168  
169 sub clear {
170  
171 $sukeycount->{_key} = '';
172 $sukeycount->{_verbose} = '';
173 $sukeycount->{_Step} = '';
174 $sukeycount->{_note} = '';
175 }
176  
177  
178 =head2 sub key
179  
180  
181 =cut
182  
183 sub key {
184  
185 my ( $self,$key ) = @_;
186 if ( $key ne $empty_string ) {
187  
188 $sukeycount->{_key} = $key;
189 $sukeycount->{_note} = $sukeycount->{_note}.' key='.$sukeycount->{_key};
190 $sukeycount->{_Step} = $sukeycount->{_Step}.' key='.$sukeycount->{_key};
191  
192 } else {
193 print("sukeycount, key, missing key,\n");
194 }
195 }
196  
197  
198 =head2 sub verbose
199  
200  
201 =cut
202  
203 sub verbose {
204  
205 my ( $self,$verbose ) = @_;
206 if ( $verbose ne $empty_string ) {
207  
208 $sukeycount->{_verbose} = $verbose;
209 $sukeycount->{_note} = $sukeycount->{_note}.' verbose='.$sukeycount->{_verbose};
210 $sukeycount->{_Step} = $sukeycount->{_Step}.' verbose='.$sukeycount->{_verbose};
211  
212 } else {
213 print("sukeycount, verbose, missing verbose,\n");
214 }
215 }
216  
217  
218 =head2 sub get_max_index
219  
220 max index = number of input variables -1
221
222 =cut
223
224 sub get_max_index {
225 my ($self) = @_;
226 my $max_index = 1;
227  
228 return($max_index);
229 }
230
231
232 1;