App-SeismicUnixGui
view release on metacpan or search on metacpan
lib/App/SeismicUnixGui/misc/sunix_pl.pm view on Meta::CPAN
#
# sub print{
# my ($self,$hash_ref_line) = @_;
# my $i=0;
# my ($seq,@print);
# #print( "self is $self,\n");
# #print("prog_line is @$ref_line\n");
# foreach $seq (@{$ref_line}) {
# $print[$i] = @{$sunix_pl->{_all_lines_aref}}[@{$ref_line}[$i]];
# #print ("line: $i @{$ref_line}[$i]\n");
# $i++;
# }i
# return(\@print);
#}
=head2 get_all_labels
return all active and default
parameter labels from a program in a perl flow
=cut
=head2 get_all_values
return all active and default
parameter values from a program in a perl flow
=cut
=head2 sub get_all_sunix_names
foreach my $keys (sort keys %$psunix) {
print("keys $keys value @{$sunix_pl->{$keys}}[1]\n");
}
this subroutine needs file read by sub lines_with
print ("i: $i fields are: @{$hash_ref->{_line_contents}}[$i] \n");
print("self is $self hash ref is $hash_ref\n");
=cut
sub get_all_sunix_names {
my ($self) = @_;
my $i = 0;
my $line;
my @fields = ();
my ( @prog_name, @extraction );
foreach ( @{ $sunix_pl->{_start_line_contents} } ) {
# print ("$i fields are: @{$sunix_pl->{_start_line_contents}}[$i] ");
$line = @{ $sunix_pl->{_start_line_contents} }[$i];
# print ("$i line is: $line ");
# match in list format @fields =
# g search globally
# \s match any whitespace character
# + match \s one or more times
# [A-za-z]+ match any letter one or more times
# [0-9]* match any number, none or more times
@fields = $line =~ /\s+\$[A-za-z]+[0-9]*[A-za-z]+[0-9]*/g;
# print ("sunix_pl,get_all_sunix_names, $i field 0 is:...$fields[0]...\n ");
@extraction = split /\s+\$/, $fields[0], 2;
# print("sunix_pl,get_all_sunix_names, $i prog_name [$extraction[1]]\n");
$prog_name[$i] = $extraction[1];
$i++;
}
$sunix_pl->{_prog_names} = \@prog_name;
# print("sunix_pl, get_all_sunix_names, sunix_names, @{$sunix_pl->{_prog_names}}\n");
return ( \@prog_name );
}
=head2 sub get_all_versions
=cut
sub get_all_versions {
my ($self) = @_;
my @version;
#print("self is $self array ref is $sunix_pl->{_prog_versions}\n");
my $num_progs = scalar @$sunix_pl{_num_progs};
#print("num_progs $num_progs\n");
# always first program is version 1
$version[0] = 1;
# 2nd program
for ( my $this = 1; $this < $num_progs; $this++ ) {
$version[$this] = 1;
for ( my $up_to = 0; $up_to < $this; $up_to++ ) {
if ( @{ $sunix_pl->{_prog_names} }[$this] eq @{ $sunix_pl->{_prog_names} }[$up_to] ) {
$version[$this]++;
}
}
}
$sunix_pl->{_prog_versions} = \@version;
# print("versions, @{$sunix_pl->{_prog_versions}}\n");
# print("versions, names:@{$sunix_pl->{_prog_names}}\n");
return ( \@version );
}
=head2 sub get_good_sunix_names
only those sunix programs
that have useful parameter
values and labels
MUST run get_good_sunix_params first (externally called)
to have
$good_prog_indices_ref
=cut
( run in 3.160 seconds using v1.01-cache-2.11-cpan-ceb78f64989 )