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

filter: Statementstmt 0.0% 0 / 22 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 37 CC 3 SCAR 13.9
CC
3
Cov
0%
string1
6.0
string2
6.0
clear
2.0
CRAP 4.0
1 package App::SeismicUnixGui::misc::mkparfile;
2  
3 use Moose;
4 our $VERSION = '0.0.1';
5  
6 =head1 DOCUMENTATION
7  
8 =head2 SYNOPSIS
9  
10 PROGRAM NAME: mkparfile
11 AUTHOR: Juan Lorenzo
12 DATE: Sept. 15 2015
13 DESCRIPTION:
14 Version: 1
15  
16 =head2 USE
17  
18 =head3 NOTES
19  
20 =head4
21 Examples
22  
23 =head3 SEISMIC UNIX NOTES
24  
25  
26  
27 =head4 CHANGES and their DATES
28  
29 =cut
30  
31 =head2 SEISMIC UNIX NOTES
32  
33 MKPARFILE - convert ascii to par file format
34
35 mkparfile <stdin >stdout
36
37 Optional parameters:
38 string1="par1" first par string
39 string2="par2" second par string
40
41 This is a tool to convert values written line by line to parameter
42 vectors in the form expected by getpar. For example, if the input
43 file looks like:
44 t0 v0
45 t1 v1
46 ...
47 then
48 mkparfile <input >output string1=tnmo string2=vnmo
49 yields:
50 tnmo=t0,t1,...
51 vnmo=v0,v1,...
52
53  
54 =head3 STEPS
55  
56 1. define the types of variables you are using
57 these would be the values you enter into
58 each of the Seismic Unix programs
59  
60 2. build a list or hash with all the possible variable
61 names you may use and you can even change them
62  
63 =cut
64  
65 my $mkparfile = {
66 _string1 => '',
67 _string2 => '',
68 _note => '',
69 _Step => ''
70 };
71  
72 # define a value
73  
74 my $newline = '';
75  
76 #sub test {
77 # my ($test,@value) = @_;
78 #print("\$test or the first scalar 'holds' a HASH $test
79 # that represents the name of the
80 # subroutine you are trying to use and all its needed components\n");
81 # print("\@value, the second scalar is something 'real' you put in, i.e., @value\n\n");
82 # print("new line is $newline\n");
83 #my ($sugain->{_Step}) = $sugain->{_Step} +1;
84 #print("Share step is first $sugain->{_Step}\n");
85  
86 =head2 subroutine clear
87  
88 sets all variable strings to ''
89  
90 =cut
91  
92 sub clear {
93 $mkparfile->{_string1} = '';
94 $mkparfile->{_string2} = '';
95 $mkparfile->{_note} = '';
96 $mkparfile->{_Step} = '';
97 }
98  
99 =head2 subroutine string1
100  
101 sets first data column in files
102  
103 =cut
104  
105 sub string1 {
106 my ( $variable, $string1 ) = @_;
107 $mkparfile->{_string1} = $string1 if defined($string1);
108 $mkparfile->{_note} =
109 $mkparfile->{_note} . ' string1=' . $mkparfile->{_string1};
110 $mkparfile->{_Step} =
111 $mkparfile->{_Step} . ' string1=' . $mkparfile->{_string1};
112 }
113  
114 =head2 subroutine string2
115  
116 sets first data column in files
117  
118 =cut
119  
120 sub string2 {
121 my ( $variable, $string2 ) = @_;
122 $mkparfile->{_string2} = $string2 if defined($string2);
123 $mkparfile->{_note} =
124 $mkparfile->{_note} . ' string2=' . $mkparfile->{_string2};
125 $mkparfile->{_Step} =
126 $mkparfile->{_Step} . ' string2=' . $mkparfile->{_string2};
127 }
128  
129 =head2 subroutine Step
130  
131 collects all program switches with the correct
132 format
133  
134 =cut
135  
136 sub Step {
137 $mkparfile->{_Step} = 'mkparfile' . $mkparfile->{_Step};
138 return $mkparfile->{_Step};
139 }
140  
141 =head2 subroutine note
142  
143 collects programs and their parameters for later logging
144  
145 =cut
146  
147 sub note {
148 $mkparfile->{_note} = $mkparfile->{_note};
149 return $mkparfile->{_note};
150 }
151  
152 =head3 Warnings for programmers
153  
154 packages must end with
155 1;
156  
157 =cut
158  
159 1;