> I seem to be having major problems getting the application devel > server (my_app_server.pl) to accept an IO::File Handle as CSV and > correctly encode as UTF-8. No, the code does exactly what you said. The problem is rather that Catalyst::Response::body wants octets, not characters. Either pass the handle through in raw mode, or encode the content again for output as UTF-8. If the input file is not under your control, I recommend going through a manual decoding/encoding step instead of IO layers, and make decoding errors fatal (see FB_CROAK in <http://p3rl.org/Encode>) in order to catch malformed encoding before it's delivered to the client. One can't be too careful.
> # close file > undef $iof; That's not necessary. When the reference falls out of scope, the destructor that closes the file is called automatically. PS: IO::File does not throw exceptions when the file could not be read. Instead I recommend to use the `open` built-in in conjuction with <http://p3rl.org/autodie> for better error checking.
signature.asc
Description: PGP signature
_______________________________________________ List: [email protected] Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/[email protected]/ Dev site: http://dev.catalyst.perl.org/
