#!/usr/local/bin/perl # # -*- Perl -*- # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # Schedule.pl Stampa Schedule # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # # Inizializzazione del sistema: # Dichiariamo quali moduli perl verranno usati e definiamo l'ambiente # di lavoro (pathname, configurazione, routine di supporto, etc) BEGIN { use File::Basename; use CGI::Carp qw(fatalsToBrowser set_message); sub handle_errors { my $msg = shift; print "

Fatal Error

"; print "$msg

Suggeriamo di tornare alla pagina precedente e riprovare."; } set_message(\&handle_errors); #fileparse_set_fstype($OS); $ThisPath = $0; ($name,$ThisPath,$type) = fileparse($ThisPath, '\.pl'); #print "Content-type: text/html\n\n"; #print ">>>$0, $ThisPath\n"; do $ThisPath."Config.pl"; do $ThisPath."DBUtility.pl"; do $ThisPath."cgi-lib.pl"; } # -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- # # Parsing of the input data. # Read protocol info and parse it. The REQUEST_METHOD may be either # GET or POST. # # Parse the query string %UserTable = (); # Parse the query string $_ = $^O; #check the host OS %UserTable=&ReadParse(); %UserTable = %in; my $risultato = ''; if (open (OUT, "> c:\\temp\\temp.txt") != 1) { $risultato = "Sailing List not available"; } else { print OUT "Prova\n"; close OUT; } if (open (IN, "< $SailsFile") != 1) { $risultato = "Sailing List not available"; } else { @Lines = ; close IN; $risultato = "

\n";
	foreach $el (@Lines) {
		$risultato .= "
$el"; } $risultato .= "
"; } my $body = ''; # Carica lo schema di pagina che deve essere generato do $ThisPath."Result.schedule.htx"; # Da qui in avanti si produce la pagina Web print "Content-type: text/html\n\n"; $ResultHtx =~ s/!body!/$risultato/g; $ResultHtx =~ s/!title!/ship schedule/g; print "$ResultHtx\n"; #End of the Program