Subject: | Option to autodie |
It would be handy if Path::Class consistently threw exceptions on failure, that would maximize its convenience.
Alas, that would bust compatibility. It could be set on object creation, but that would also be inconvenient. Using a lexical pragma "use Path::Class ':autodie'" could make all Path::Class objects in scope autodie. This lexical pragma would basically just flip a $DIE flag inside Path::Class.
An alternative is to put the autodie flag per object, that could be done by exporting the appropriate file() or dir() depending on if ":autodie" is given. This isn't as good a solution because Path::Class objects may be created outside the code in question, for example passed in as arguments, and you want them to behave consistently regardless of origin.
Thoughts?
Alas, that would bust compatibility. It could be set on object creation, but that would also be inconvenient. Using a lexical pragma "use Path::Class ':autodie'" could make all Path::Class objects in scope autodie. This lexical pragma would basically just flip a $DIE flag inside Path::Class.
An alternative is to put the autodie flag per object, that could be done by exporting the appropriate file() or dir() depending on if ":autodie" is given. This isn't as good a solution because Path::Class objects may be created outside the code in question, for example passed in as arguments, and you want them to behave consistently regardless of origin.
Thoughts?