sub MaintenancePage { q{ MAINTENANCE PAGE

MAINTENANCE PAGE


Circle:                Technology :


   
}; } ## end sub MaintenancePage #### #!/usr/bin/perl #use strict; #use warnings; use CGI 'header'; use CGI::Carp qw(fatalsToBrowser); local ($buffer, @pairs, $pair, $name, $value, %FORM); $ENV{'REQUEST_METHOD'} =~ tr/a-z/A-Z/; if ($ENV{'REQUEST_METHOD'} eq "POST") { read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); } else { $buffer = $ENV{'QUERY_STRING'}; } @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%(..)/pack("C", hex($1))/eg; $FORM{$name} = $value; } $Circle = $FORM{Customer}; $Techno = $FORM{Techno}; $filename = $Circle.'_'.$Techno.'.csv'; my $files_location = "/opt/IBM/Maintenance/archive"; if (!$filename) { die "You must specify a file to download"; exit; } print header( -type => 'text/csv', -content_disposition => "attachment;filename=$filename", ); my $fileloc = "$files_location/$filename"; open my $fh, '<', $fileloc or Error('open', 'file', $!); print while <$fh>; close $fh or Error ('close', 'file' ); sub Error { die "@_"; }