Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use Fatal qw(:lexical) throws autodie::exception #61

Closed
nthykier opened this issue Dec 26, 2014 · 2 comments
Closed

use Fatal qw(:lexical) throws autodie::exception #61

nthykier opened this issue Dec 26, 2014 · 2 comments
Assignees

Comments

@nthykier
Copy link
Contributor

After a bit of testing (see commit dc33f2b), it turns out that the code:

use Fatal qw(:lexical open);

open(my $fd, '<', 'missing-file');

Thows an exception like "use autodie qw(open)" would have (in fact said exception is an autodie::exception). Using git bisect, I have determined this has happened since commit 54d2fbd, so this behaviour has been defacto standard since 2008. This leads to the question: If we separate autodie from Fatal (issue #60), how should "use Fatal qw(:lexical ...)" behave? I see the following options:

  1. Keep existing behaviour by "promoting" it to "autodie" (i.e. make use "Fatal qw(:lexical ... );" basically the same as "use autodie qw(...);").
  2. Have "use Fatal qw(:lexical ...);" throw "old-style" exceptions.
  3. Remove support for ":lexical" in Fatal completely (possibly with a "grace period" filled with deprecation warnings).

Note that the "Fatal" POD does not mention the ":lexical" tag at all (but it used to do). I suspect this to be by intention as the documentation suggests Fatal to be deprecated in favor of autodie. This begs the question, is ":lexical" now just an implementation-detail that we can change at will?

@pjf: Any suggestions? Otherwise, I will probably go with 1. as it seems to be the "most backwards compatible" option, given the lifetime of this bug.

@nthykier nthykier self-assigned this Dec 26, 2014
@pjf
Copy link
Collaborator

pjf commented Dec 28, 2014

I'd suggest either 1 or 3, both are relatively safe. '3' means that :lexical becomes a compile-time error, which means there's much less of there being surprises for our users, whereas '1' means nothing changes at all.

I'm not sure any code out there actually uses :lexical. It was very much there as a potential interface, which was obviously dropped in favour of the autodie pragma.

So either 1 or 3; if in doubt, I agree with 1, as it won't cause any problems no matter what crazy things our users have done. :)

~ Paul

@nthykier
Copy link
Contributor Author

Ok, I think I will go with 1) and deprecate the usage of "use Fatal qw(:lexcial)", so we can eventually implement 3). Thanks for your remarks. :)

nthykier added a commit that referenced this issue Dec 29, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants