#!/usr/bin/perl -w { # makenetcdf.pl (from makematlab.pl) Aug 05 $version = "makenetcdf.pl version 1.1 5 Sep 11"; # 5 Sep 11 wjs v 1.1 # Preallocate error file so it can receive "out of disk space" error messages # 19 Jul 08 wjs v 1.0b # Use check_build_opt_env_var # Bug fix: code optionally uses nctest, but looks like it will # reject all files if nctest isn't around. Change that # 21 May 07 wjs v 1.0a # Add undef of global $open_pre_tag to get rid of "only 1 use" diagnostic require ("cgi-lib.pl"); require "wjs_web_perl_utilities.pl"; # Set up environment. Assume .pl routine is in our directory $build_opt_env = "./build-opt-env.pl"; &check_r_access($build_opt_env); require $build_opt_env; # Define form action routine and hidden html var name for that routine. $form_action = "form_action"; $form_action_routine = $ENV{"SCRIPT_NAME"} ? $ENV{"SCRIPT_NAME"} : "/jg/makenetcdf.pl"; # Check that build-opt-env set up things as expected $opthome = &check_build_opt_env_var('OPTHOME',$build_opt_env); $bindir = &abs_filespec($opthome,"Env var OPTHOME") . "/bin"; # Preallocation stuff. Assume .pl program is in our directory $copy_into_preallocated_file = "./copy_into_preallocated_file.pl"; &check_x_access($copy_into_preallocated_file); $preallocation_size = 10000; # html form variable names $alpha_list_form_var_name = "list_of_alpha_variables"; $object_form_var_name = "object_spec"; &ReadParse(*form_info); # Main purpose of putting form action routine on form as a hidden # variable is to distinguish between use of this program in the # "put the form up" and "process the form results" modes. The # consistency check is just on general principles - anyone who de- # liberately mis-routes things here can change the hidden value as well. if ( $after_submit = (defined $form_info{$form_action}) ) { ($form_info{$form_action} eq $form_action_routine) || &quit ("Submit action routine should be same as form value" , "Action = $form_action_routine; " . "Form value = $form_info{$form_action}" ); } if ($after_submit) { &process_form; } else { &print_form; } exit; } sub print_form { &printheader(); print "\n"; $title = 'Netcdf alpha variable selection page'; print "