YAML.pm(as well as
YAML::Syck) do not accept file handles as arguments to
LoadFile(but only filenames). So to read a YAML from
*DATA, I wrote a piece of code like this:
use File::Slurp qw( read_file );
use YAML qw( Load Dump );
my $etc = Load(read_file(\*DATA)); # <= that's what matters!!!
Only to find out it printed:
which definitely was not what I was looking for. The problem is that
read_file is called in a list context and
"perl:\n" is the only argument
YAML::Load cares for. The fix:
my $etc = Load(scalar read_file(\*DATA));
The issue was a combination of
File::Slurp trying to be handy and
YAML not being helpful enough. It happens and calls for an improved API.