From: Peter Rabbitson Date: Sat, 14 Aug 2010 10:27:53 +0000 (+0200) Subject: Stop relying on ->can in the SQL::Abstract carp-hack, allows X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e8fc51c7ae51c4b7b181967b3b1da12cc951c3f6;p=dbsrgits%2FDBIx-Class-Historic.git Stop relying on ->can in the SQL::Abstract carp-hack, allows proper use of namespace::clean --- diff --git a/lib/DBIx/Class/SQLAHacks.pm b/lib/DBIx/Class/SQLAHacks.pm index 3cf750c..adb06a9 100644 --- a/lib/DBIx/Class/SQLAHacks.pm +++ b/lib/DBIx/Class/SQLAHacks.pm @@ -10,8 +10,8 @@ use strict; use warnings; use List::Util 'first'; use Sub::Name 'subname'; -use namespace::clean; use Carp::Clan qw/^DBIx::Class|^SQL::Abstract|^Try::Tiny/; +use namespace::clean; BEGIN { # reinstall the carp()/croak() functions imported into SQL::Abstract @@ -21,10 +21,11 @@ BEGIN { for my $f (qw/carp croak/) { my $orig = \&{"SQL::Abstract::$f"}; + my $clan_import = \&{$f}; *{"SQL::Abstract::$f"} = subname "SQL::Abstract::$f" => sub { if (Carp::longmess() =~ /DBIx::Class::SQLAHacks::[\w]+ .+? called \s at/x) { - __PACKAGE__->can($f)->(@_); + $clan_import->(@_); } else { goto $orig;