#!/usr/bin/perl                                                     # ============================================== # Program : view_doc.pl - Opens documents from server and returns back to browser # # Created : 23.01.2004 # ============================================== # == MODULES ============================================== #use strict;                                                       use warnings;                                                       use CGI::Carp qw(fatalsToBrowser);                                 use CGI qw/:standard/;                                             # =//============================================ # == GLOBAL VARS DECLARATION ===================== my $query = new CGI; my $id = $query->param(id); my $datei = $query->param(source); my $speed = 5*1024; # 5kb pro Sek. my $mimetype =(); # =//============================================ # == PROGRAM CODE ============================================== if ($id == "1"){ $mimetype = "Content-Type: application/pdf\n\n"; } if ($id == "2"){ $mimetype = "Content-Type: text/xml\n\n"; } print $mimetype; open(FILE,"<".$datei) || die $!; binmode(FILE); binmode(STDOUT); my $buffer; while (read(FILE,$buffer,$speed)) {       print STDOUT $buffer;               sleep(1); } close (FILE); # =//============================================