X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSQLAHacks.pm;h=c0b9937215e76ea45d33d7faf5eb75a652d4daf6;hb=d1ec2830cc15412c0a99d77b97dc95393af1e66a;hp=f05970baba13939432f2838fff36ac3e9791bfb2;hpb=1cbd30341b52723431f4ae937df004ba81428619;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/SQLAHacks.pm b/lib/DBIx/Class/SQLAHacks.pm index f05970b..c0b9937 100644 --- a/lib/DBIx/Class/SQLAHacks.pm +++ b/lib/DBIx/Class/SQLAHacks.pm @@ -4,7 +4,28 @@ package # Hide from PAUSE use base qw/SQL::Abstract::Limit/; use strict; use warnings; -use Carp::Clan qw/^DBIx::Class/; +use Carp::Clan qw/^DBIx::Class|^SQL::Abstract/; + +BEGIN { + # reinstall the carp()/croak() functions imported into SQL::Abstract + # as Carp and Carp::Clan do not like each other much + no warnings qw/redefine/; + no strict qw/refs/; + for my $f (qw/carp croak/) { + my $orig = \&{"SQL::Abstract::$f"}; + *{"SQL::Abstract::$f"} = sub { + + local $Carp::CarpLevel = 1; # even though Carp::Clan ignores this, $orig will not + + if (Carp::longmess() =~ /DBIx::Class::SQLAHacks::[\w]+\(\) called/) { + __PACKAGE__->can($f)->(@_); + } + else { + $orig->(@_); + } + } + } +} sub new { my $self = shift->SUPER::new(@_);