sub_cruiseinfo.pl 1.41 KB
sub sub_cruiseinfo {

	$name   = $_[0] ;
	$folder = $_[1] ;

	# does this cruise already have a mission log?
	if (-e "$folder/LogGen/$name.out") {
		# Open the file handle to append
		# Get the stations
		# Get the operations
	
	} else { # this cruise does not already have an output file
	# MANAGE FILE HANDLES 
		# create and open the outfile handle 
		open(OUT,">$folder/LogGen/$name.out") || die("EXIT!! : Did not find LogGen folder or cruise folder\n")  ;
		print ">> Enter operations, 		end with CTRL-d		: " ;
		
		# operations to be conducted
		$numops = 0 ;
		while ( <STDIN> ) {
			chop($_) ;
			push(@ops,$_) ;
			print ">> 							: " ;
			$numops++ ;
		}
		print "\n" ;
		
		
		# stations to be visited 
		$numsts = 0 ;
		print ">> Enter stations names, 	end with CTRL-d		: " ;
		while (<STDIN>) {
			chop($_) ;
			push(@sts,$_) ;
			print ">> 							: " ;
			$numsts++ ;
		}
		print "\n\n\n" ;
	
		# print header to outputfile
		print OUT "\# $name\n" ;
		print OUT "\# $folder\n" ;
		print OUT "\# $numops\n" ;
		for ($ii=0;$ii<$numops;$ii++) { print OUT "\# $ops[$ii]\n" ; }
		print OUT "\# $numsts\n" ;
		for ($ii=0;$ii<$numsts;$ii++) { print OUT "\# $sts[$ii]\n" ; }
		print OUT "\# 0\n" ;
		$cul = 0 ;	
		print OUT "\# Type lon     lat     yyyy mm dd HH MM SS Name\n" ;
	
		$headerstring = "Starting operations log for $name cruise" ;
	
	}

	# RETURN NEEDED VALUES
	return (\@ops,\@sts,$numops,$numsts,$headerstring) ;


}

1;