X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader%2FBase.pm;h=50b478241c944fcee60ffea8672553aa3faafb4e;hb=f671b6308c4f2210255b2eaa12fc47a49621d436;hp=01f925fc864bb9b2c0b90753f3fd366aa51fe210;hpb=53e721bce0ce6df2b721c52ec331a8098e55b533;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/lib/DBIx/Class/Schema/Loader/Base.pm b/lib/DBIx/Class/Schema/Loader/Base.pm index 01f925f..50b4782 100644 --- a/lib/DBIx/Class/Schema/Loader/Base.pm +++ b/lib/DBIx/Class/Schema/Loader/Base.pm @@ -18,13 +18,13 @@ use Class::Unload; use Class::Inspector (); use Scalar::Util 'looks_like_number'; use File::Slurp 'slurp'; -use DBIx::Class::Schema::Loader::Utils qw/split_name dumper_squashed/; +use DBIx::Class::Schema::Loader::Utils qw/split_name dumper_squashed eval_without_redefine_warnings/; use DBIx::Class::Schema::Loader::Optional::Dependencies (); use Try::Tiny; use DBIx::Class (); use namespace::clean; -our $VERSION = '0.07001'; +our $VERSION = '0.07002'; __PACKAGE__->mk_group_ro_accessors('simple', qw/ schema @@ -844,14 +844,7 @@ sub _load_external { $code = $self->_rewrite_old_classnames($code); if ($self->dynamic) { # load the class too - # kill redefined warnings - my $warn_handler = $SIG{__WARN__} || sub { warn @_ }; - local $SIG{__WARN__} = sub { - $warn_handler->(@_) - unless $_[0] =~ /^Subroutine \S+ redefined/; - }; - eval $code; - die $@ if $@; + eval_without_redefine_warnings($code); } $self->_ext_stmt($class, @@ -892,14 +885,7 @@ been used by an older version of the Loader. * PLEASE RENAME THIS CLASS: from '$old_class' to '$class', as that is the new name of the Result. EOF - # kill redefined warnings - my $warn_handler = $SIG{__WARN__} || sub { warn @_ }; - local $SIG{__WARN__} = sub { - $warn_handler->(@_) - unless $_[0] =~ /^Subroutine \S+ redefined/; - }; - eval $code; - die $@ if $@; + eval_without_redefine_warnings($code); } chomp $code; @@ -1125,12 +1111,9 @@ sub _reload_class { delete $INC{ $class_path }; # kill redefined warnings - my $warn_handler = $SIG{__WARN__} || sub { warn @_ }; - local $SIG{__WARN__} = sub { - $warn_handler->(@_) - unless $_[0] =~ /^Subroutine \S+ redefined/; + eval { + eval_without_redefine_warnings ("require $class"); }; - eval "require $class;"; die "Failed to reload class $class: $@" if $@; }