use Digest::MD5;
use File::Find 'find';
use Class::Unload ();
-use DBIx::Class::Schema::Loader::Utils qw/dumper_squashed slurp_file/;
+use DBIx::Class::Schema::Loader::Utils qw/dumper_squashed slurp_file sigwarn_silencer/;
use List::MoreUtils 'apply';
use DBIx::Class::Schema::Loader::Optional::Dependencies ();
use Try::Tiny;
sub _monikerize {
my $name = shift;
- return 'LoaderTest2X' if $name =~ /^loader_test2$/i;
- return undef;
+ my $orig = pop;
+ return $orig->({
+ loader_test2 => 'LoaderTest2X',
+ LOADER_TEST2 => 'LoaderTest2X',
+ });
}
sub run_tests {
'is_nullable=1 detection';
SKIP: {
- skip $self->{skip_rels}, 137 if $self->{skip_rels};
+ skip $self->{skip_rels}, 145 if $self->{skip_rels};
my $moniker3 = $monikers->{loader_test3};
my $class3 = $classes->{loader_test3};
# relname is preserved when another fk is added
{
- local $SIG{__WARN__} = sub { warn @_ unless $_[0] =~ /invalidates \d+ active statement/ };
+ local $SIG{__WARN__} = sigwarn_silencer(qr/invalidates \d+ active statement/);
$conn->storage->disconnect; # for mssql and access
}
my $guard = $conn->txn_scope_guard;
- my $warn_handler = $SIG{__WARN__} || sub { warn @_ };
- local $SIG{__WARN__} = sub {
- $warn_handler->(@_)
- unless $_[0] =~ RESCAN_WARNINGS
- || $_[0] =~ /commit ineffective with AutoCommit enabled/; # FIXME
- };
+ my $rescan_warnings = RESCAN_WARNINGS;
+ local $SIG{__WARN__} = sigwarn_silencer(
+ qr/$rescan_warnings|commit ineffective with AutoCommit enabled/ # FIXME
+ );
my $schema_from = DBIx::Class::Schema::Loader::make_schema_at(
"TestSchemaFromAnother", \%opts, [ sub { $conn->storage->dbh } ]
@first_table_types = grep !/$split_off_re/, @types;
}
- @types = +{ map +($_, $types->{$_}), @first_table_types },
- map +{ $_, $types->{$_} }, @split_off_types;
+ @types = (
+ +{ map +($_, $types->{$_}), @first_table_types },
+ map +{ $_, $types->{$_} }, @split_off_types,
+ );
my $test_count = 0;
my $table_num = 10000;
sub rescan_without_warnings {
my ($self, $conn) = @_;
- local $SIG{__WARN__} = sub { warn @_ unless $_[0] =~ RESCAN_WARNINGS };
+ local $SIG{__WARN__} = sigwarn_silencer(RESCAN_WARNINGS);
return $conn->rescan;
}