App-SeismicUnixGui

 view release on metacpan or  search on metacpan

lib/App/SeismicUnixGui/misc/config_superflows.pm  view on Meta::CPAN


		my $name_sref = $config_superflows->{_program_name_sref};

 # print("config_superflows, get_local_or_defaults,program name=$$name_sref\n");
		print(
"config_superflows, get_local_or_defaults,SCALAR program name=$name_sref\n"
		);

		$cfg_aref = $big_streams_param->get($name_sref);

		print(
			"config_superflows, get_local_or_defaults,cfg_aref = @{$cfg_aref}\n"
		);
		return ($cfg_aref);

		#		}
	}
	else {
		print(
"config_superflows, get_local_or_defaults,missing program_name_sref\n"
		);
	}

}

=head2 sub save

	i/p: has a reference with the names values and program name
	names are in an array reference
	values are too
	no need for checkbuttons
        # print("config_superflows,save\nprog_name: ${$out_hash_ref->{_prog_name}}");
        # print("  labels: @{$out_hash_ref->{_ref_labels}}\n");
        # print("  values: @{$out_hash_ref->{_ref_values}}\n");

=cut

sub save {

	my ( $self, $in_hash_ref ) = @_;
#		print(
#"config_superflows,save,in_hash_ref:...${$in_hash_ref->{_prog_name_sref}}...)\n"
#		);
	if ( defined $in_hash_ref
      &&  ${$config_superflows->{_program_name_sref}}  ne $empty_string )
	{

		my $out_hash_ref = {
			_ref_labels     => '',
			_ref_values     => '',
			_prog_name_sref => '',
		};

		my $files_LSU = files_LSU->new();

		$out_hash_ref->{_ref_labels} = $in_hash_ref->{_names_aref};
		$out_hash_ref->{_ref_values} = $in_hash_ref->{_values_aref};

# N.B. IT is NOT $in_hash_ref->{_prog_name_sref};
		$out_hash_ref->{_prog_name_sref} =
		  $config_superflows->{_program_name_sref}; # backup

# print("config_superflows,save,out_hash_ref, ${$out_hash_ref->{_prog_name_sref}}\n");
# print("config_superflows,save,out_hash_ref,@{$out_hash_ref->{_ref_values}}[1]\n");
# print("config_superflows,save,out_hash_ref,@{$out_hash_ref->{_ref_labels}}\n");
# print("config_superflows,save,values are,@{$out_hash_ref->{_ref_values}}\n");

		if ( ${ $out_hash_ref->{_prog_name_sref} } eq 'Project' ) {

			# Single special case
#			print("CASE config_superflows,save, for special Project case\n");
			$files_LSU->set_Project_config();
			# NEXT 3 are scalar ref
			$files_LSU->set_prog_name_sref( $out_hash_ref->{_prog_name_sref} );
			$files_LSU->set_outbound( $out_hash_ref->{_prog_name_sref} ); 
			$files_LSU->set_superflow_specs($out_hash_ref);
			
			# to /home/gom/.L_SU/configuration/active/Project.config	  
			$files_LSU->write(); 
			
			# also create additional directory and file in the configuration area
			# of the project. 
			# to /home/gom/.L_SU/configuration/ProjectName/Project.config
			# If directories are missing some will be created.
			# scalar ref
			$files_LSU->set_outbound2( $out_hash_ref->{_prog_name_sref} ); 
			
			$files_LSU->write2();    
	    

		}
		else {
			my @format;

	        # CASE 2 all other superflow configuration files except for Project.config
	  		
			$files_LSU->set_config();
			$files_LSU->set_prog_name_sref( $out_hash_ref->{_prog_name_sref} )
			  ;    # scalar ref
#			print("CASE 2 config_superflows,save, for other cases\n");
#			print(" config_superflows,save,program name = ${$out_hash_ref->{_prog_name_sref}}\n");
			$files_LSU->outbound();
			$files_LSU->set_superflow_specs($out_hash_ref);    # scalar ref

			my $program_name_sref = _get_program_name();

			if ( $$program_name_sref ne $empty_string ) {

				if ( $$program_name_sref eq 'immodpg' ) {

	 # carp("config_superflows,save,progam_name_sref= ${$program_name_sref}\n");

					@format = @{ $var_immodpg->{_format_aref} };

		  #		        print("1. config_superflows, _write,formats =@format  \n");
					$files_LSU->set_superflow_config_file_format( \@format );

				}
				else {
					# All other superflows/big_streams
					$format[0] = $var->{_config_file_format};



( run in 1.090 second using v1.01-cache-2.11-cpan-39bf76dae61 )