# HG changeset patch # User devi # Date 1132696172 -7200 # Node ID 5499496e2462ebbb3568466b01847c84f10f523f # Parent 6452bfe549d1e7b585706da16967076b38d27388 Печать сначала в переменную, а потом всё выводим сразу diff -r 6452bfe549d1 -r 5499496e2462 l3-cgi --- a/l3-cgi Tue Nov 22 23:27:51 2005 +0200 +++ b/l3-cgi Tue Nov 22 23:49:32 2005 +0200 @@ -13,11 +13,13 @@ for my $key (qw(login_from)) { $filter{$key} = param($key) if param($key); + $filter{$key} = $ENV{$key} if defined $ENV{$key}; } my %Trainings; my $XMLTraining; my %Machines; +my $print = ""; sub load_training { @@ -35,7 +37,7 @@ return $XMLTraining; } -print header( +$print .= header( -charset => "utf-8", ); @@ -48,87 +50,87 @@ my $training = load_training($training_file); $Trainings{$training->{"date"}}=$training; } - print "\n"; - print "\n"; - print "Журналы лабораторных работ\n"; - print "\n"; - print "\n"; - print "\n"; + $print .= "\n"; + $print .= "\n"; + $print .= "Журналы лабораторных работ\n"; + $print .= "\n"; + $print .= "\n"; + $print .= "
\n"; for my $tdate (reverse sort keys %Trainings) { my $t = $Trainings{$tdate}; - print ""; - print ""; - print ""; - print "\n"; - print ""; - print ""; + $print .= ""; + $print .= ""; + $print .= "\n"; + $print .= ""; + $print .= "\n"; + $print .= "\n"; } - print "
".$t->{date}."".$t->{course}."
"; - print "
";
+			$print .= "
".$t->{date}."".$t->{course}."
"; + $print .= "
";
 			for my $host (sort keys %{$t->{host}}) {
 				my $h = $t->{host}->{$host};
-				print "$host";
-				print " ".$h->{firstname}." ".$h->{surname}." ";
-				print "root ";
-				print "".$h->{user}." ";
-				print "\n";
+				$print .= "$host";
+				$print .= " ".$h->{firstname}." ".$h->{surname}." ";
+				$print .= "root ";
+				$print .= "".$h->{user}." ";
+				$print .= "\n";
 			}
-			print "
"; - print "
"; + $print .= "
\n"; - print "\n"; - print "\n"; + $print .= "\n"; + $print .= "\n"; + $print .= "\n"; } else { - print "No training-files found
\n"; - print "Template to load files: ".$l3config::Config{"path_classes"}."*".$l3config::Config{"class_suffix"}."\n" + $print .= "No training-files found
\n"; + $print .= "Template to load files: ".$l3config::Config{"path_classes"}."*".$l3config::Config{"class_suffix"}."\n" } } elsif ($ENV{PATH_INFO} eq "/current/index" || $ENV{PATH_INFO} eq "") { my $t = load_training(); - print "\n"; - print "\n"; - print "Журналы лабораторных работ\n"; - print "\n"; - print "\n"; - print "\n"; - print "

Журналы лабораторных работ

\n"; - print "\n"; - print "\n"; - print ""; - print ""; - print ""; - print "\n"; + $print .= "\n"; + $print .= "\n"; + $print .= "Журналы лабораторных работ\n"; + $print .= "\n"; + $print .= "\n"; + $print .= "\n"; + $print .= "

Журналы лабораторных работ

\n"; + $print .= "
"."Имя"."ХостПользователь
\n"; + $print .= "\n"; + $print .= ""; + $print .= ""; + $print .= ""; + $print .= "\n"; for my $host (sort keys %{$t->{host}}) { my $prefix = "/cgi-bin/l3/current/"; my $suffix = ""; - print "\n"; + $print .= "\n"; my $h = $t->{host}->{$host}; - print ""; - print ""; - print ""; - print ""; - print ""; - print "\n"; - print "\n"; + $print .= ""; + $print .= ""; + $print .= ""; + $print .= ""; + $print .= ""; + $print .= "\n"; + $print .= "\n"; } - print "\n"; - print ""; - print ""; - print ""; - print "\n"; - print "
"."Имя"."ХостПользователь
".$h->{firstname}." ".$h->{surname}."$hostroot".$h->{user}."все
".$h->{firstname}." ".$h->{surname}."$hostroot".$h->{user}."все
"."Инструктор"."from linux.nt"; - print ""; - print "все
\n"; - print "\n"; - print "\n"; + $print .= "\n"; + $print .= ""."Инструктор".""; + $print .= "from linux.nt"; + $print .= ""; + $print .= ""; + $print .= "все"; + $print .= "\n"; + $print .= "\n"; + $print .= "\n"; + $print .= "\n"; } elsif ($ENV{PATH_INFO} eq "/current") { open (FRONTEND, "./l3-frontend --output - --show_comments no |"); while () { - print; + $print .=; } close(FRONTEND); } @@ -160,8 +162,9 @@ open (FRONTEND, "./l3-frontend ".join(" ",map("\"$_\"",@args))." |"); while () { - print; + $print .= $_; } close(FRONTEND); } +print $print; diff -r 6452bfe549d1 -r 5499496e2462 lm --- a/lm Tue Nov 22 23:27:51 2005 +0200 +++ b/lm Tue Nov 22 23:49:32 2005 +0200 @@ -129,9 +129,6 @@ sub load_scripts { - print join " ", %Config; - print "\n"; - open (SCRIPTS, "$Config{l3scripts}") or die "Cant open l3scripts file: ".$Config{l3scripts}.": $!\n"; binmode SCRIPTS, ":utf8";