perl: September 2006 Archives
If you use Activestate's port of Perl on Windows and you've installed a few CPAN modules using PPM, chances are you'll have started getting annoyong Parser error messages. Have a read of this by Tom "hitman" Hukins on how to hack those useless errors out of your life:
Here's the scenario: I wanted to be able to produce tumbnail images on the fly so that a user could upload their photos to a site and then in their page templates use a cgi call as the img src, passing the desired width and height as arguments to the script. For example:
Anyway, the problem appears to be that the FCGI module ties STDOUT to itself, whilst Image::Magick appears to want to do the same. Conflict ensues and when you call the Image::Magick Write method, your image is written to your Apache error log. Bugger. The solution then would appear to be to untie STDOUT from FCGI and tie it to Image::Magick. So that's what I'm going to do, soon. Watch this space...
Update: see my more recent post on this subject with a happy solution
<img src="/cgi-bin/image.fcgi?name=photo1.jpg&width=100&height=150"; alt="" />Not rocket science, is it, and it works fine as a normal CGI, but I wanted to run it under FastCGI for obvious reasons: It's a low volume site, so I can afford the overhead of generating thumbnails on the fly, but the speed savings from using FastCGI would be appreciated.
Anyway, the problem appears to be that the FCGI module ties STDOUT to itself, whilst Image::Magick appears to want to do the same. Conflict ensues and when you call the Image::Magick Write method, your image is written to your Apache error log. Bugger. The solution then would appear to be to untie STDOUT from FCGI and tie it to Image::Magick. So that's what I'm going to do, soon. Watch this space...
Update: see my more recent post on this subject with a happy solution
