1 BEGIN { do "./t/lib/ANFANG.pm" or die ( $@ || $! ) }
9 use DBICTest::Util 'tmpdir';
10 use DBIx::Class::_Util 'scope_guard';
14 open(my $stderr_copy, '>&', *STDERR) or die "Unable to dup STDERR: $!";
15 my $tf = File::Temp->new( UNLINK => 1, DIR => tmpdir() );
19 # ensure Devel::StackTrace-refcapture-like effects are countered
21 my $s = DBICTest::Schema->connect('dbi:SQLite::memory:');
22 my $g = $s->txn_scope_guard;
26 local $SIG{__WARN__} = sub {
29 while (my @f = CORE::caller(++$frnum) ) {
30 push @arg_capture, @DB::args;
38 my $guard = scope_guard {
40 open(STDERR, '>&', $stderr_copy);
41 $output = do { local (@ARGV, $/) = $tf; <> };
49 open(STDERR, '>&', $tf) or die "Unable to reopen STDERR: $!";
51 # this should emit on stderr
57 qr/\QPreventing *MULTIPLE* DESTROY() invocations on DBIx::Class::Storage::TxnScopeGuard/,
58 'Proper warning emitted on STDERR'