in reply to Re: Re: Perl Style: About error messges opening files
in thread Perl Style: About error messges opening files

BTW, the problem I have with something like what you describe here is that it wont be able to show the filename involved will it?
Since about all pdie and perror do is tack "$!\n" to the die or warning message, I fail to agree.
open my $fh => $file or pdie open => $file;
might print "open /ect/passwd: No such file or directory".

Abigail

Replies are listed 'Best First'.
Re: Re: Perl Style: About error messges opening files
by demerphq (Chancellor) on Apr 27, 2004 at 12:06 UTC

    Since about all pdie and perror do is tack "$!\n" to the die or warning message, I fail to agree.

    Ah. Yeah. Good idea and point. :-) Might be worthy doing cluck/carp/croak/confess versions as well as the warn/die variants though.


    ---
    demerphq

      First they ignore you, then they laugh at you, then they fight you, then you win.
      -- Gandhi


      Considering that perror and pdie don't print line numbers, carp and croak versions would not add anything. Also, I'd expect terseness when perror or pdie are used - not something I associate with the stack traces of cluck and confess. So, I don't see much added value in adding c-variants. But anyone could subclass it to PError::Carp, ;-).

      Abigail

Re: Re: Perl Style: About error messges opening files
by flyingmoose (Priest) on Apr 27, 2004 at 14:17 UTC
    The purpose of perror is largely to explain ERRNO, same as $!. We don't need a module or function for this. Many C programmers who love perror() -- including myself -- get along just fine with $!.
    A reply falls below the community's threshold of quality. You may see it by logging in.