git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Bruhat (BooK)" <book@cpan.org>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Git.pm: better error message
Date: Mon, 14 Jun 2010 11:19:16 +0200	[thread overview]
Message-ID: <20100614091916.GB31387@swoosh> (raw)
In-Reply-To: <20100614071046.GA5639@sigill.intra.peff.net>

On Mon, Jun 14, 2010 at 03:10:46AM -0400, Jeff King wrote:
> 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))

  reply	other threads:[~2010-06-14  9:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-14  1:00 [PATCH] Git.pm: better error message Philippe Bruhat (BooK)
2010-06-14  7:10 ` Jeff King
2010-06-14  9:19   ` Philippe Bruhat (BooK) [this message]
2010-06-14  9:20     ` Jeff King
2010-06-17 23:47 ` Philippe Bruhat (BooK)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100614091916.GB31387@swoosh \
    --to=book@cpan.org \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).