Apache2-REST
view release on metacpan or search on metacpan
lib/Apache2/REST/Handler/bin.pm view on Meta::CPAN
=head1 NAME
Apache2::REST::Handler::bin - Proof of concept for binary output.
=cut
=head2 GET
Ouputs the logo png image
=cut
sub GET{
my ( $self , $req , $resp ) = @_ ;
$req->requestedFormat('bin') ;
$resp->binMimeType('image/png') ;
my $exFile = __FILE__ ;
$exFile =~ s/bin\.pm$/bin_logo.png/ ;
open ( INFILE , '<'.$exFile ) or die "Cannot open $exFile\n" ;
my $bin = '' ;
{
local $/ = undef ;
$bin = <INFILE>;
}
close INFILE ;
$resp->bin($bin) ;
( run in 0.804 second using v1.01-cache-2.11-cpan-2398b32b56e )