I've an Apache2/mod_perl2 system ready to go.

I am using GD to produce a picture quickly, and I am then printing it such as this:

binmode STDOUT;
print $im->png;

But is the right way to complete things in mod_perl2?

(Ignore the truth that I am producing a picture quickly and never caching it and so on..)

Under mod_perl2, you shouldn't print stuff straight to STDOUT. Rather, use

use Apache2::Const 'OK';

$r->content_type( 'image/png' );
$r->print( $im->png );

return OK;