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

Re: [PATCH] Git.pm: better error message

From
Philippe Bruhat (BooK) <book@cpan.org>
Date
Jun 14, 2010, 09:19 UTC
Message-ID
<20100614091916.GB31387@swoosh>
In-Reply-To
<20100614071046.GA5639@sigill.intra.peff.net>
On Mon, Jun 14, 2010 at 03:10:46AM -0400, Jeff King wrote:
Show 17 quoted lines
> On Mon, Jun 14, 2010 at 03:00:22AM +0200, Philippe Bruhat (BooK) wrote:
> 
> > -d doesn't set $! if the directory doesn't exist
> 
> Really?
> 
>   $ perl -e '-d "bogus" or die "fail: $!"'
>   fail: No such file or directory at -e line 1.
> 
> On the other hand:
> 
>   $ touch file
>   perl -e '-d "file" or die "fail: $!"'
>   fail:  at -e line 1.
> 
> So perhaps it is best not to rely on $!. Also, this is with perl 5.10.
> Is it different with other versions?

Come to think of it, it probably makes sense: -d probably depends on stat to get the information about the file, and that fails harder when the file in question doesn't exists.

I guess the best would be to put the directory name in the error message (always interesting information), and keep $! in case it was set by an harder error.

-- 
 Philippe Bruhat (BooK)

 There is no solution to a problem of sheer greed.
                                    (Moral from Groo The Wanderer #94 (Epic))
Previous: Jeff KingNext: Jeff King
Message 3 of 5 in “Git.pm: better error message”
  1. Git.pm: better error messagePhilippe Bruhat (BooK), Jun 14, 2010
  2. Jeff KingJun 14, 2010
  3. Philippe Bruhat (BooK)Jun 14, 2010
  4. Jeff KingJun 14, 2010
  5. Git.pm: better error messagePhilippe Bruhat (BooK), Jun 17, 2010

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.