Thread Perl-Skript Portierung: IIS5 -> IIS6
(11 answers)
Opened by Gast at 2008-09-18 19:00
Teil 3/3:
Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 elsif( $Line =~ /\S+/ ) { if( $name ) { $FldEmptyLines -= $EmptyLines; } else { $FldEmptyLines++; } undef $name; $Buffer .= '%0D%0A' x $FldEmptyLines; $FldEmptyLines = 0; $Buffer .= &Ansii2Ascii( $Line ); print DBG "Varvalue:$Line\n" if $debug; $CountLines = 0; } else { $CountLines && $EmptyLines++; $FldEmptyLines++; } } } $Buffer =~ s/^&//; } close DBG if $debug; unlink $path."h".$last.".tmp"; unlink $path."h".$last.".out"; $name = $path."h".$last.".tmp"; print LARSOUT $Buffer; close(LARSOUT); rename( $name, $path."h".$last.".in" ); &Timer( 'Start' ); $gefunden = 0; while($gefunden != 1) { $name = $path."h".$last.".out"; if(open(NEUDAT, "<".$name) != 0) { $gefunden = 1; } else { exit if &Timer( 'Test' ); sleep 1; } } print "Content-type: text/html\n\n"; while(<NEUDAT>) { print; } close(NEUDAT); $name = $path."h".$last.".out"; unlink $name; sub Ansii2Ascii { local( $wert ) = @_; # $wert =~ s/(.)/$map{$wert} || $wert /ge; $wert =~ s/\&/%26/g; return $wert; } sub Timer { local( $What ) = @_; if( $What eq 'Start' ) { $StartTime = time(); return 0; } elsif( $What eq 'Test' ) { return ( time() - $StartTime ) > $TimeOutMinutes * 60; } } |