Subject: | Would like to be able to pass IO::File handles to Dump/LoadFile |
Date: | Mon, 18 Jun 2012 16:31:39 +1000 |
To: | bugs-yaml-tiny [...] rt.cpan.org |
From: | Daniel Carosone <daniel.carosone [...] gmail.com> |
It would be nice to be able to pass an io handle to LoadFile/Dumpfile,
rather than just a string filename. Obvious use case would be layered gzip
compression, though Archive::Zip::MemberRead and many others might also be
useful.
The alternative is passing a content string fetched already to read_string.
There's no saving of efficiency since that's what read does internally
anyway, but it would make for much neater calling code to just be able to
pass the handle.
The write() function looks like it might just work passing a ":layer
filename" string, because it concat's "<" onto the start for a 2-argument
open.
The read() function does a bunch of -f tests on the passed string which
defeat attempts to pass a 2-argument open string.
I haven't actually tried this trick with write, mostly because I want it
more for LoadFile and IO:Uncompress:AnyUncompress with transparent (to not
care whether i have manually gzip'd the files), and it won't work there.
A very-low priority wishlist item, but: I notice some other comments about
utf8 encoding, and wonder whether the solution to those doesn't also
involve allowing it to use perlio layers.
--
Dan.