Apache-ASP
view release on metacpan or search on metacpan
site/eg/binary_write.htm view on Meta::CPAN
#!/usr/bin/perl /usr/bin/asp-perl
<%
use File::Basename;
if($Request->QueryString('type') eq 'gif') {
$Response->{ContentType} = 'image/gif';
open(FILE, 'test.gif') || die "can't open test.gif";
binmode FILE;
$/ = undef;
my $data = <FILE>;
$Response->Clear;
$Response->AddHeader('Content-Length', length $data);
$Response->BinaryWrite($data);
$Response->End;
} else {
%>
<!--#include file=header.inc-->
We are going to load a gif through this
same script as an example of doing a $Response->BinaryWrite()...
<p>
<img src="<%=basename($0)%>?type=gif">
<p>
Please note that if you are on Win32, you will need to
call binmode on a file handle before reading, if
its data is binary.
<!--#include file=footer.inc-->
<% } %>
( run in 0.572 second using v1.01-cache-2.11-cpan-d8267643d1d )