develooper Front page | perl.perl5.porters | Postings from May 2004

[PATCH] Fix anomalies in Carp functions

Thread Next
From:
Steve Hay
Date:
May 25, 2004 08:00
Subject:
[PATCH] Fix anomalies in Carp functions
Message ID:
40B3609E.5060502@uk.radan.com
Twice before I've tried to get Carp changed so that carp() et al 
consistently suppress the " at <file> line <line>" message which they 
normally append to their argument if it ends with a newline.  See:

http://www.xray.mpe.mpg.de/cgi-bin/w3glimpse/perl5-porters?query=honour+trailing+newlines&errors=0&case=on&maxfiles=100&maxlines=30

At the last attempt, Nick I-S pointed out that this an absurd request -- 
if you don't want such extra information, then why call carp() & friends 
in the first place?  Why not just use warn(), which does behave this way 
:)  The whole point of carp() etc is to give extra information.

My confusion arose from the fact that carp() sometimes *does* suppress 
the extra message, and cluck() always suppresses the extra bit (though 
not the stacktrace).  The same situation arises w.r.t. croak() and 
confess().  This can all be seen from the attached foo.pl script and 
Foo.pm module.

The attached patch irons out these oddities, and adjusts a couple of 
tests that are affected.

- Steve


------------------------------------------------
Radan Computational Ltd.

The information contained in this message and any files transmitted with it are confidential and intended for the addressee(s) only.  If you have received this message in error or there are any problems, please notify the sender immediately.  The unauthorized use, disclosure, copying or alteration of this message is strictly forbidden.  Note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of Radan Computational Ltd.  The recipient(s) of this message should check it and any attached files for viruses: Radan Computational will accept no liability for any damage caused by any virus transmitted by this email.

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About