CARVIEW |
Select Language
HTTP/2 200
cache-control: max-age=43200
server: Combust/Plack (Perl)
vary: Accept-Encoding
content-encoding: gzip
content-length: 2811
content-type: text/html; charset=utf-8
last-modified: Sun, 12 Oct 2025 00:26:24 GMT
traceparent: d36f6ec5ca9d8298fb3becfeabd0ca0c
strict-transport-security: max-age=15768000
Re: my $@ - a proposal - nntp.perl.org
Front page | perl.perl5.porters |
Postings from June 2008
nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About

Re: my $@ - a proposal
Thread Previous | Thread NextFrom:
Yuval KogmanDate:
June 27, 2008 07:45Subject:
Re: my $@ - a proposalMessage ID:
20080627144517.GZ23537@woobling.orgOn Fri, Jun 27, 2008 at 13:53:39 +0200, Abigail wrote: > I've been wondering, I've used > > eval { ... }; > if ($@) { > ... whatever ... > } > > for about dozen years, > > and I cannot recall it ever not doing 'whatever' if the eval fails. This happens if objects allocated within the eval { } have a DESTROY that has an eval { } that doesn't fail. This doesn't happen often, but when it does happen it's one of the nastiest problems to debug, due to the fact that the code relates to error handling, and the fact that the invocation is implicit. > Having said that, I think that any fix should target the > > eval { ... }; > if ($@) { ... } > > case. That's how the majority of the people think exceptions work, and they > will continue to code this way. Agreed Making local $@/die DWIM like the previous thread mentioned makes writing defensive that doesn't break this easier A lexical $@ makes this even easier, my $@; eval { ... } if ($@) { ... } is 100% safe no matter what for that particular error (no local $@ can touch that particular $@) It would be interesting to find a way for 'use 5.012' code to automatically create a lexical $@, similarly to how $1, $2 etc are treated -- Yuval Kogman <nothingmuch@woobling.org> https://nothingmuch.woobling.org 0xEBD27418Thread Previous | Thread Next
- my $@ - a proposal by Yuval Kogman
- RE: my $@ - a proposal by Jan Dubois
- Re: my $@ - a proposal by David Nicol
- Re: my $@ - a proposal by Graham Barr
- Re: my $@ - a proposal by David Nicol
- Re: my $@ - a proposal by Mark Mielke
- RE: my $@ - a proposal by Jan Dubois
- Re: my $@ - a proposal by Graham Barr
- Re: my $@ - a proposal by Graham Barr
- RE: my $@ - a proposal by Jan Dubois
- Re: my $@ - a proposal by Ben Morrow
- Re: my $@ - a proposal by Graham Barr
- RE: my $@ - a proposal by Jan Dubois
- Re: my $@ - a proposal by David Nicol
- RE: my $@ - a proposal by Jan Dubois
- Re: my $@ - a proposal by David Nicol
- RE: my $@ - a proposal by Jan Dubois
- Re: my $@ - a proposal by David Golden
- Re: my $@ - a proposal by Johan Vromans
- Re: my $@ - a proposal by Mark Mielke
- Re: my $@ - a proposal by Rafael Garcia-Suarez
- Re: my $@ - a proposal by Mark Mielke
- Re: my $@ - a proposal by Ben Morrow
- Re: my $@ - a proposal by Elliot Shank
- Re: my $@ - a proposal by Abigail
- Re: my $@ - a proposal by Juerd Waalboer
- Re: my $@ - a proposal by David Golden
- Re: my $@ - a proposal by Yuval Kogman
- Re: my $@ - a proposal by David Golden
- Re: my $@ - a proposal by Graham Barr
- Re: my $@ - a proposal by Yuval Kogman
- Re: my $@ - a proposal by Graham Barr
- Re: my $@ - a proposal by Sam Vilain
- Re: my $@ - a proposal by David Nicol
- Re: my $@ - a proposal by David Golden
- Re: my $@ - a proposal by Graham Barr
- Re: my $@ - a proposal by David Nicol
- RE: my $@ - a proposal by Jan Dubois
- Re: my $@ - a proposal by Aristotle Pagaltzis
- Re: my $@ - a proposal by Mark Mielke
- Re: my $@ - a proposal by Raphael_Manfredi
- Re: my $@ - a proposal by Mark Mielke
- Re: my $@ - a proposal by Raphael_Manfredi
- Re: my $@ - a proposal by Abigail
- Re: my $@ - a proposal by Mark Mielke
- Re: my $@ - a proposal by David Golden
- Re: my $@ - a proposal by Raphael_Manfredi
- Re: my $@ - a proposal by Dr.Ruud
- Re: my $@ - a proposal by Yuval Kogman
- Re: my $@ - a proposal by Sam Vilain
- Re: my $@ - a proposal by Abigail
- Re: my $@ - a proposal by Yuval Kogman
- Re: my $@ - a proposal by Sean O'Rourke
- Re: my $@ - a proposal by Yuval Kogman
- Re: my $@ - a proposal by Steffen Mueller
- Re: my $@ - a proposal by Yuval Kogman
- Re: my $@ - a proposal by David Golden
- Re: my $@ - a proposal by Yuval Kogman
- Re: my $@ - a proposal by David Golden
- Re: my $@ - a proposal by Abigail
- Re: my $@ - a proposal by Aristotle Pagaltzis
- Re: my $@ - a proposal by Mark Mielke
- Re: my $@ - a proposal by Yuval Kogman
- Re: my $@ - a proposal by Dr.Ruud
- Re: my $@ - a proposal by Mark Mielke
- Re: my $@ - a proposal by Sam Vilain
- Re: my $@ - a proposal by David Cantrell
- Re: my $@ - a proposal by Sam Vilain
- Re: my $@ - a proposal by Moritz Lenz
- Re: my $@ - a proposal by Sam Vilain
- Re: my $@ - a proposal by Moritz Lenz
- Re: my $@ - a proposal by Sam Vilain
- Re: my $@ - a proposal by Moritz Lenz
- Re: my $@ - a proposal by Sam Vilain
- Re: my $@ - a proposal by Abigail
- Re: my $@ - a proposal by Mark Mielke
- Re: my $@ - a proposal by Aristotle Pagaltzis
- Re: my $@ - a proposal by David Nicol
- Re: my $@ - a proposal by Nicholas Clark
- Re: my $@ - a proposal by David Nicol
- RE: my $@ - a proposal by Jan Dubois
- Re: my $@ - a proposal by David Nicol
- Re: my $@ - a proposal by Reini Urban
- Re: my $@ - a proposal by Dr.Ruud
- Re: my $@ - a proposal by Sam Vilain
nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About