title: What is the right way to serve dynamically generated images using Apache and mod_perl?
body: <p>I have an Apache2/mod_perl2 system up and running.</p>
  
  <p>I'm using <a href="http://search.cpan.org/perldoc/GD" rel="nofollow noreferrer">GD</a> to create an image on the fly, and I'm then printing it like this:</p>
  
  <pre><code>$r-&gt;content_type('image/png');
  binmode STDOUT;
  print $im-&gt;png;
  </code></pre>
  
  <p>But is this the correct way to do things in <a href="http://perl.apache.org/" rel="nofollow noreferrer"><code>mod_perl2</code></a>?</p>
  
  <p>(Ignore the fact that I'm generating an image on the fly and not caching it etc ...)</p>