lib/App/SeismicUnixGui/sunix/shell/cat_su.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%
base_file_name1
6.0
base_file_name2
6.0
Step
2.0
CRAP 3.3
1 package App::SeismicUnixGui::sunix::shell::cat_su;
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 Usage for cat module in L_SU
25  
26 cat derives from unix command of the same name
27  
28  
29  
30 Added: by Juan Lorenzo Jan. 2022
31  
32
33 Usage: cat base_file_name1='sufile1' base_file_name2='sufile2' > output_file
34  
35  
36 base_file_name1=first (su file)
37  
38 base_file_name2=second optional (su file)
39  
40 output file is handled by module data_out.pm
41  
42 =head2 User's notes (Juan Lorenzo)
43  
44 untested
45  
46 =cut
47  
48  
49 =head2 CHANGES and their DATES
50  
51 =cut
52  
53 use Moose;
54 our $VERSION = '0.0.1';
55  
56 =head2 Import packages
57  
58 =cut
59  
60 use App::SeismicUnixGui::misc::L_SU_global_constants;
61 use App::SeismicUnixGui::misc::SeismicUnix qw($go $in $off $on $out $ps $to $suffix_ascii
62 $suffix_bin $suffix_ps $suffix_segy $suffix_su);
63  
64 use App::SeismicUnixGui::configs::big_streams::Project_config;
65  
66 =head2 instantiation of packages
67  
68 =cut
69  
70 my $get = App::SeismicUnixGui::misc::L_SU_global_constants->new();
71 my $Project = App::SeismicUnixGui::configs::big_streams::Project_config->new();
72  
73 my $DATA_SEISMIC_SU = $Project->DATA_SEISMIC_SU();
74 my $DATA_SEISMIC_BIN = $Project->DATA_SEISMIC_BIN();
75 my $DATA_SEISMIC_TXT = $Project->DATA_SEISMIC_TXT();
76  
77 my $PS_SEISMIC = $Project->PS_SEISMIC();
78  
79 my $var = $get->var();
80 my $on = $var->{_on};
81 my $off = $var->{_off};
82 my $true = $var->{_true};
83 my $false = $var->{_false};
84 my $empty_string = $var->{_empty_string};
85  
86 =head2 Encapsulated
87 hash of private variables
88  
89 =cut
90  
91 my $cat_su = {
92 _base_file_name1 => '',
93 _base_file_name2 => '',
94 _Step => '',
95 _note => '',
96  
97 };
98  
99 =head2 sub Step
100  
101 collects switches and assembles bash instructions
102 by adding the program name
103  
104 =cut
105  
106 sub Step {
107  
108 $cat_su->{_Step} = 'cat '.$cat_su->{_Step};
109 return ( $cat_su->{_Step} );
110  
111 }
112  
113  
114 =head2 sub note
115  
116 collects switches and assembles bash instructions
117 by adding the program name
118  
119 =cut
120  
121 sub note {
122  
123 $cat_su->{_note} = 'cat'.$cat_su->{_note};
124 return ( $cat_su->{_note} );
125  
126 }
127  
128  
129 =head2 sub clear
130  
131 =cut
132  
133 sub clear {
134  
135 $cat_su->{_base_file_name1} = '';
136 $cat_su->{_base_file_name2} = '';
137 $cat_su->{_Step} = '';
138 $cat_su->{_note} = '';
139 }
140  
141  
142 =head2 sub base_file_name1
143  
144  
145 =cut
146  
147 sub base_file_name1 {
148  
149 my ( $self,$base_file_name1 ) = @_;
150 if ( $base_file_name1 ne $empty_string ) {
151  
152 $cat_su->{_base_file_name1} = $base_file_name1;
153 $cat_su->{_note} = $cat_su->{_note}.' '.$cat_su->{_base_file_name1};
154 $cat_su->{_Step} = $cat_su->{_Step}.' '.$cat_su->{_base_file_name1};
155  
156 } else {
157 print("cat_su, base_file_name1, missing base_file_name1,\n");
158 }
159 }
160  
161  
162 =head2 sub base_file_name2
163  
164  
165 =cut
166  
167 sub base_file_name2 {
168  
169 my ( $self,$base_file_name2 ) = @_;
170 if ( $base_file_name2 ne $empty_string ) {
171  
172 $cat_su->{_base_file_name2} = $base_file_name2;
173 $cat_su->{_note} = $cat_su->{_note}.' '.$cat_su->{_base_file_name2};
174 $cat_su->{_Step} = $cat_su->{_Step}.' '.$cat_su->{_base_file_name2};
175  
176 } else {
177 print("cat_su, base_file_name2, missing base_file_name2,\n");
178 }
179 }
180  
181  
182 =head2 sub get_max_index
183  
184 max index = number of input variables -1
185
186 =cut
187
188 sub get_max_index {
189 my ($self) = @_;
190 my $max_index = 1;
191  
192 return($max_index);
193 }
194
195
196 1;