in reply to perl -COE and, for example, CGI::Application

I've not seen -C options before today, but they're all documented here quite nicely: http://perldoc.perl.org/perlrun.html. I might find a use for them myself...

The option to use UTF-8 for STDOUT breaks down when trying to output anything other than text: The 'U' is for Unicode, which implies text data.

Image files aren't text (as usual, there are some esoteric exceptions, but in general...) so putting them through a UTF-8 encoder is like running a gamma correction on a perl script.

In this case, I'd suggest that you have two reasonable options:

  1. Stick with your current approach (default to UTF-8 with the -COE options, and switch to ":raw" when you need to output non-text), or
  2. Remove the -C option completely, and defer selection of ":utf8" or ":raw" until the point at which your code is able to identify what it's going to be outputting.
  • Comment on Re: perl -COE and, for example, CGI::Application

Replies are listed 'Best First'.
Re^2: perl -COE and, for example, CGI::Application
by isync (Hermit) on Sep 23, 2008 at 11:12 UTC
    Although I am proud of myself for once using the -C options which are new to you ;-) I now have reverted to not using them after the discussion with karavelov. As shown, my updated approach is to use a :utf8 on the start of each script-cycle and in the few cycles my script outputs image/binary data I tell it to switch to :utf8 on a per-case basis. So I am d'accord with what you are concluding!