sub getimage { my $self = shift; my $stuff = shift; # Set the correct header $self->header_props( -type=>$stuff->{mime} ); open ( IMAGE , $stuff->{image} ) or die "Screaming $!"; return join '', ; } #### #!/usr/bin/perl -w # foo.pm , to be executed by Apache package foo; use strict; use base 'CGI::Application'; use CGI::Carp; sub handler { warn "## handler"; my $request = shift; my $app = foo->new(); $app->run(); exit; } sub setup { warn "## setup"; my $self = shift; $self->run_modes( start=>'start' ); } sub start { warn "## start"; my $self = shift; open ( FH , '/path/to/some/image' ) or confess $!; $self->header_props( -type=>'your/mimetype' ); return join '' , ; } 1; #### PerlModule Apache PerlModule foo SetHandler perl-script PerlHandler foo