Subject: | Specification for LoadFile (and others) does not state what occurs on error |
The spec for LoadFile doesn't say what happens if there is an error
loading the file.
Both YAML and YAML::Syck currently raise an exception with a value which
is a string, though the format is quite different in each case. For
reference, an example from my YAML is:
YAML Error: Couldn't open /noexist for input:\nBad file descriptor
Code: YAML_LOAD_ERR_FILE_INPUT
at /home/tom/jiffies/perl/yaml_load_file_errors line 11
and an example from my YAML::Syck is:
'/noexist' is empty or non-existant at /usr/lib/perl5/YAML/Syck.pm
line 129.
I understand that YAML is an interface that has multiple
implementations, and so the interface documentation serves as a spec for
implementors as well as a guide for consumers of the interface. I'm not
quite sure what the process is for revising the interface spec, which is
why I'm not proposing a patch at this stage. For example, if there is a
YAML implementation which currently handles LoadFile errors differently,
it could currently still be a correct implementation, since the
behaviour of LoadFile on error is currently undefined. So some kind of
negotiation / warning period / etc for implementers may be required
before altering the interface spec.
So if anyone is able to describe or point me to a description of the
process for revising the Perl YAML interface spec, that would be a good
next step.
I see that error behaviour for other functions in the YAML interface is
also undefined, so perhaps a more general effort is required to define
these.