in reply to Serve image from file

Replies are listed 'Best First'.
Re^2: Serve image from file
by ruzam (Curate) on Apr 28, 2006 at 22:47 UTC
    Sometimes I also do session verification, which is why the environment variables crept in, so I suppose that's best left to what ever external code needs to be called. I'd skip the use CGI alltogether, but depending on how I need to get the path, it's usually there anyway. Speaking of CGI, I suppose it would be faster to skip CGI as well and simply print the headers directly?

    For an image dump, what would you suggest to end the script other than die? My thinking is the output of die never makes it to the client (at least not in any readable way, 'cause it's an image), but you at least get the results in the Apache error logs. I suppose that could be considered either good or bad.

    Your $/ trick is very clever. I like it. But is it any better/worse on performance? Dumping images is such a lowly task for Perl. I'd hate to waste anymore cycles then absolutely necessary doing it :)