in reply to Re: Trouble working with Config::Simple
in thread Trouble working with Config::Simple

'~/.kenesis' couldn't be opened for writing: No such file or directory

I doubt, though, that this message would have helped a lot here.  Someone starting out with the conviction that ~ (tilde) would work from Perl like it does in the shell, would probably have begun wondering why their home directory isn't writable for themselves, or some such... :)

Replies are listed 'Best First'.
Re^3: Trouble working with Config::Simple
by linuxer (Curate) on Jun 30, 2008 at 21:18 UTC

    The message is telling exactly what's wrong. There is no directory '~'. It doesn't say anything about a "permission denied". So, there's no need to wonder.

    I think if it would do a ~ expansion, it should state the expanded path in the error message (just like the shell does).

    $ touch ~/test.txt $ chmod a-w ~/test.txt $ echo "string" > ~/test.txt bash: /home/user/test.txt: Permission denied $
      The message is telling exactly what's wrong.

      Sure it is. But the point is how you'd interpret the message if you think that '~' stands for your home directory. Of course, once you reckon what the problem is, it's all nice and dandy.

      Honestly, if some message reports a problem with ~/somefile, would your first thought be that the real problem is that ~ has nothing to do with your home directory? Even details such as "Permission denied" vs. "No such file or directory" etc., or whether the shell would normally expand tilde in an error message, might not immediately point in the right direction. — Believe me, I've seen rather skilled programmers tricked by this...

        Without a moments thought, yes, many skilled programmers would be fooled by that. But in the same vein from all the "unskilled" programmers out there there should be some who get a "stroke of insight" after looking at that error message. And often that is also the moment they learn that error messages are a source of information not to be clicked away

        At the least the message pinpoints the problem area. As soon as someone knows how to debug, he's got a lead now.

Re^3: Trouble working with Config::Simple
by kyle (Abbot) on Jun 30, 2008 at 20:35 UTC

    That's true, but it would have been a good clue to us. I started answering the OP without even knowing how Config::Simple reports errors. Having the error in front of me would have gotten me to the answer faster.