<%init> use Apache::Constants qw(NOT_FOUND); use GD; my ($file) = $m->dhandler_arg =~ /(\w+\.png)$/; $m->clear_and_abort(NOT_FOUND) unless $file; return if $m->cache_self( key => $file ); $r->content_type('image/png'); my $image = new GD::Image(100, 100); my $red = $image->colorAllocate(255, 0, 0); $image->filledRectangle( 25, 25, 75, 75, $red); $m->clear_buffer; print $image->png;