git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [1.8.0] perl/Git.pm: moving away from using Error.pm module

From
NNick <oinksocket@letterboxes.org>
Date
Feb 21, 2011, 11:02 UTC
Message-ID
<4D624632.80904@letterboxes.org>
In-Reply-To
<7v4o7xluph.fsf@alter.siamese.dyndns.org>
On 21/02/11 07:20, Junio C Hamano wrote:
> If we are going to change things so that everybody uses a
> more traditional "eval {}; if ($@) { ... }", it would be a welcome change
> from my point of view.
A small aside - note the "Dangers of using $@" described here:
  http://www.socialtext.net/perl5/exception_handling
To paraphrase, this:
  eval { stuff ; 1} or do { handle_exception };
is marginally safer than:
  eval { stuff }; if (defined $@) { handle_exception }

because it is possible that $@ can be modified (say, by a DESTROY method) before the if clause sees it. The former idiom does not stop that, it just means your exception handler is executed reliably.

Normally it is not a problem, but this is still something worth knowing.
N
Previous: Jakub NarebskiNext: Jakub Narebski
Message 4 of 7 in “[1.8.0] perl/Git.pm: moving away from using Error.pm module”
  1. Jakub NarebskiFeb 20, 2011
  2. Junio C HamanoFeb 21, 2011
  3. Jakub NarebskiFeb 21, 2011
  4. NickFeb 21, 2011
  5. Jakub NarebskiFeb 21, 2011
  6. Ævar Arnfjörð BjarmasonFeb 21, 2011
  7. AvnerApr 15, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.