Subject: | Carp::Clan triggers overloading when examining @DB::args |
Carp::Clan::_longmess calls overloading on objects found in @DB::args
but should not. Use overload::StrVal instead to get a proper
stringification.
The attached patch updates the module to be overload safe. You could
just apply the patch and it'll increment the version # for you and
everything. If you don't want to deal with this, please assign me
co-maintainer permissions (or greater) and I'll release this to CPAN.
I have a module that would really benefit by using your library but I
can't do it until this bug is fixed.
Subject: | Carp-Clan-5.4.diff |
Only in Carp-Clan-5.4: blib
diff -ru Carp-Clan-5.3/CHANGES.txt Carp-Clan-5.4/CHANGES.txt
--- Carp-Clan-5.3/CHANGES.txt 2004-04-30 03:38:07.000000000 -0500
+++ Carp-Clan-5.4/CHANGES.txt 2006-08-15 11:48:33.000000000 -0500
@@ -1,5 +1,5 @@
====================================
- Package "Carp::Clan" Version 5.3
+ Package "Carp::Clan" Version 5.4
====================================
@@ -10,6 +10,10 @@
Version history:
----------------
+Version 5.4 15.08.2006
+
+ + Doesn't call overloading magic anymore
+
Version 5.3 30.04.2004
+ Removed the paragraph saying "no tests available" from README.txt
Only in Carp-Clan-5.4: CHANGES.txt~
diff -ru Carp-Clan-5.3/Clan.pm Carp-Clan-5.4/Clan.pm
--- Carp-Clan-5.3/Clan.pm 2004-04-30 03:38:07.000000000 -0500
+++ Carp-Clan-5.4/Clan.pm 2006-08-15 11:47:21.000000000 -0500
@@ -15,6 +15,7 @@
use strict;
use vars qw( $MaxEvalLen $MaxArgLen $MaxArgNums $Verbose $VERSION );
+require overload;
# Original comments by Andy Wardley <abw@kfs.org> 09-Apr-1998.
@@ -27,7 +28,7 @@
$Verbose = 0; # If true then make _shortmsg call _longmsg instead.
-$VERSION = '5.3';
+$VERSION = '5.4';
# _longmsg() crawls all the way up the stack reporting on all the function
# calls made. The error string, $error, is originally constructed from the
@@ -77,7 +78,7 @@
{
if (ref $_)
{
- $_ = "$_"; # Beware of overloaded objects!
+ $_ = overload::StrVal( $_ );
}
else
{
Only in Carp-Clan-5.4: Clan.pm~
Only in Carp-Clan-5.4: Makefile
Only in Carp-Clan-5.4: pm_to_blib
diff -ru Carp-Clan-5.3/README.txt Carp-Clan-5.4/README.txt
--- Carp-Clan-5.3/README.txt 2004-04-30 03:38:07.000000000 -0500
+++ Carp-Clan-5.4/README.txt 2006-08-15 11:47:30.000000000 -0500
@@ -1,5 +1,5 @@
====================================
- Package "Carp::Clan" Version 5.3
+ Package "Carp::Clan" Version 5.4
====================================
Only in Carp-Clan-5.4: README.txt~
diff -ru Carp-Clan-5.3/t/01_______carp.t Carp-Clan-5.4/t/01_______carp.t
--- Carp-Clan-5.3/t/01_______carp.t 2004-04-30 03:38:07.000000000 -0500
+++ Carp-Clan-5.4/t/01_______carp.t 2006-08-15 11:45:02.000000000 -0500
@@ -13,7 +13,7 @@
# NOTE: Certain ugly contortions needed only for crappy Perl 5.6.0!
# (sorry for the outbreak :-) )
-print "1..58\n";
+print "1..59\n";
my $n = 1;
@@ -552,5 +552,38 @@
{print "ok $n\n";} else {print "not ok $n\n";}
$n++;
+if ( not eval 'require Object::Deadly; 1' ) {
+ print "ok $n # skip Overload safety testing needs Object::Deadly\n";
+ $n++;
+}
+else {
+ $SIG{ALRM} = sub { die "ALRM\n" };
+ alarm 10;
+ eval {
+ sub {
+ my @args = @_;
+ sub {
+ Carp::Clan::confess( scalar @args );
+ }->( @args );
+ }->( Object::Deadly->new )
+ };
+ my $e = $@;
+ alarm 0;
+ $e =~ s/^/# /mg;
+ if ( $e eq '' ) {
+ print "not ok $n # Carp::Clan::confess didn't run\n";
+ }
+ elsif ( $e =~ /ALRM/ ) {
+ print "$e\nnot ok $n # infinite loop\n";
+ }
+ elsif ( $e =~ /Object::Deadly trace/ ) {
+ print "$e\nnot ok $n # triggered overloading\n";
+ }
+ else {
+ print "ok $n\n";
+ }
+ ++ $n;
+}
+
__END__
Only in Carp-Clan-5.4/t: 01_______carp.t~