lib/App/SeismicUnixGui/sunix/par/a2i.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%
n
6.0
n1
6.0
outpar
6.0
CRAP 3.7
1 package App::SeismicUnixGui::sunix::par::a2i;
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 A2I - convert Ascii to binary Integers
25  
26  
27  
28 a2i <stdin >stdout outpar=/dev/tty
29  
30  
31  
32 Required parameters:
33  
34 none
35  
36  
37  
38 Optional parameters:
39  
40 n1=2 integers per line in input file
41  
42  
43  
44 outpar=/dev/tty output parameter file, contains the
45  
46 number of lines (n=)
47  
48  
49  
50 =head2 User's notes (Juan Lorenzo)
51 untested
52  
53 =cut
54  
55  
56 =head2 CHANGES and their DATES
57  
58 =cut
59  
60 use Moose;
61 our $VERSION = '0.0.1';
62  
63  
64 =head2 Import packages
65  
66 =cut
67  
68 use aliased 'App::SeismicUnixGui::misc::L_SU_global_constants';
69  
70 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii $suffix_bin $suffix_ps $suffix_segy $suffix_su);
71 use aliased 'App::SeismicUnixGui::configs::big_streams::Project_config';
72  
73  
74 =head2 instantiation of packages
75  
76 =cut
77  
78 my $get = L_SU_global_constants->new();
79 my $Project = Project_config->new();
80 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
81 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
82 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
83  
84 my $PS_SEISMIC = $Project->PS_SEISMIC();
85  
86 my $var = $get->var();
87 my $on = $var->{_on};
88 my $off = $var->{_off};
89 my $true = $var->{_true};
90 my $false = $var->{_false};
91 my $empty_string = $var->{_empty_string};
92  
93 =head2 Encapsulated
94 hash of private variables
95  
96 =cut
97  
98 my $a2i = {
99 _n => '',
100 _n1 => '',
101 _outpar => '',
102 _Step => '',
103 _note => '',
104  
105 };
106  
107 =head2 sub Step
108  
109 collects switches and assembles bash instructions
110 by adding the program name
111  
112 =cut
113  
114 sub Step {
115  
116 $a2i->{_Step} = 'a2i'.$a2i->{_Step};
117 return ( $a2i->{_Step} );
118  
119 }
120  
121  
122 =head2 sub note
123  
124 collects switches and assembles bash instructions
125 by adding the program name
126  
127 =cut
128  
129 sub note {
130  
131 $a2i->{_note} = 'a2i'.$a2i->{_note};
132 return ( $a2i->{_note} );
133  
134 }
135  
136  
137  
138 =head2 sub clear
139  
140 =cut
141  
142 sub clear {
143  
144 $a2i->{_n} = '';
145 $a2i->{_n1} = '';
146 $a2i->{_outpar} = '';
147 $a2i->{_Step} = '';
148 $a2i->{_note} = '';
149 }
150  
151  
152 =head2 sub n
153  
154  
155 =cut
156  
157 sub n {
158  
159 my ( $self,$n ) = @_;
160 if ( $n ne $empty_string ) {
161  
162 $a2i->{_n} = $n;
163 $a2i->{_note} = $a2i->{_note}.' n='.$a2i->{_n};
164 $a2i->{_Step} = $a2i->{_Step}.' n='.$a2i->{_n};
165  
166 } else {
167 print("a2i, n, missing n,\n");
168 }
169 }
170  
171  
172 =head2 sub n1
173  
174  
175 =cut
176  
177 sub n1 {
178  
179 my ( $self,$n1 ) = @_;
180 if ( $n1 ne $empty_string ) {
181  
182 $a2i->{_n1} = $n1;
183 $a2i->{_note} = $a2i->{_note}.' n1='.$a2i->{_n1};
184 $a2i->{_Step} = $a2i->{_Step}.' n1='.$a2i->{_n1};
185  
186 } else {
187 print("a2i, n1, missing n1,\n");
188 }
189 }
190  
191  
192 =head2 sub outpar
193  
194  
195 =cut
196  
197 sub outpar {
198  
199 my ( $self,$outpar ) = @_;
200 if ( $outpar ne $empty_string ) {
201  
202 $a2i->{_outpar} = $outpar;
203 $a2i->{_note} = $a2i->{_note}.' outpar='.$a2i->{_outpar};
204 $a2i->{_Step} = $a2i->{_Step}.' outpar='.$a2i->{_outpar};
205  
206 } else {
207 print("a2i, outpar, missing outpar,\n");
208 }
209 }
210  
211  
212 =head2 sub get_max_index
213  
214 max index = number of input variables -1
215
216 =cut
217
218 sub get_max_index {
219 my ($self) = @_;
220 my $max_index = 2;
221  
222 return($max_index);
223 }
224
225
226 1;