« lib/App/SeismicUnixGui/developer/code/sunix/sunix_package_header.pm
↑ Summary
lib/App/SeismicUnixGui/sunix/statsMath/sumix.pm »
| 1 | package App::SeismicUnixGui::misc::param; | ||
| 2 | use Moose; | ||
| 3 | our $VERSION = '0.0.1'; | ||
| 4 | |||
| 5 | =head2 initialize shared anonymous hash | ||
| 6 | |||
| 7 | key/value pairs | ||
| 8 | |||
| 9 | =cut | ||
| 10 | |||
| 11 | my $param = { | ||
| 12 | _file_in => '', | ||
| 13 | _file_out => '', | ||
| 14 | _length => '', | ||
| 15 | _path_out => '', | ||
| 16 | _outbound => '', | ||
| 17 | }; | ||
| 18 | |||
| 19 | =head2 sub file_in | ||
| 20 | file_out | ||
| 21 | print("file_in is $param->{_file_in}\n"); | ||
| 22 | path_out | ||
| 23 | =cut | ||
| 24 | |||
| 25 | sub file_in { | ||
| 26 | my ( $self, $file_aref ) = @_; | ||
| 27 | $param->{_file_in} = @$file_aref[0]; | ||
| 28 | } | ||
| 29 | |||
| 30 | =head2 sub file_out | ||
| 31 | |||
| 32 | print("file_out is $param->{_file_out}\n"); | ||
| 33 | |||
| 34 | =cut | ||
| 35 | |||
| 36 | sub file_out { | ||
| 37 | my ( $self, $file_aref ) = @_; | ||
| 38 | $param->{_file_out} = @$file_aref[0]; | ||
| 39 | } | ||
| 40 | |||
| 41 | =head2 sub path_out | ||
| 42 | |||
| 43 | print("path_out is $param->{_path_out}\n"); | ||
| 44 | |||
| 45 | =cut | ||
| 46 | |||
| 47 | sub path_out { | ||
| 48 | my ( $self, $file_aref ) = @_; | ||
| 49 | $param->{_path_out} = @$file_aref[0]; | ||
| 50 | } | ||
| 51 | |||
| 52 | =head2 sub param_names | ||
| 53 | |||
| 54 | print("param_names is $param->{_param_names}\n"); | ||
| 55 | |||
| 56 | =cut | ||
| 57 | |||
| 58 | sub param_names { | ||
| 59 | my ( $self, $names_aref ) = @_; | ||
| 60 | $param->{_param_names} = $names_aref; | ||
| 61 | print("param,param_names @{$param->{_param_names}}\n"); | ||
| 62 | $param->{_length} = scalar @$names_aref; | ||
| 63 | } | ||
| 64 | |||
| 65 | =head2 sub param_values | ||
| 66 | |||
| 67 | print("param_values is $param->{_param_values}\n"); | ||
| 68 | |||
| 69 | =cut | ||
| 70 | |||
| 71 | sub param_values { | ||
| 72 | my ( $self, $values_aref ) = @_; | ||
| 73 | $param->{_param_values} = $values_aref; | ||
| 74 | $param->{_length} = scalar @$values_aref; | ||
| 75 | print("param,param_values @{$param->{_param_values}}\n"); | ||
| 76 | } | ||
| 77 | |||
| 78 | =pod sub write | ||
| 79 | |||
| 80 | open and write | ||
| 81 | to the file | ||
| 82 | |||
| 83 | =cut | ||
| 84 | |||
| 85 | sub write { | ||
| 86 | my ($self) = shift; | ||
| 87 | |||
| 88 | if ( $param->{_file_out} && $param->{_length} ) { # avoids errors | ||
| 89 | |||
| 90 | $param->{_outbound} = $param->{_path_out} . $param->{_file_out}; | ||
| 91 | |||
| 92 | open my $OUT, '>', $param->{_outbound} or die; | ||
| 93 | |||
| 94 | for ( my $i = 0 ; $i < $param->{_length} ; $i++ ) { | ||
| 95 | print $OUT ( | ||
| 96 | "@{$param->{_param_names}}[$i] = @{$param->{_param_values}}[$i]\n" | ||
| 97 | ); | ||
| 98 | } | ||
| 99 | |||
| 100 | close($OUT); | ||
| 101 | } | ||
| 102 | |||
| 103 | } | ||
| 104 | |||
| 105 | 1; |