HEX
Server: Apache
System: Linux server-674799.igrow.ws 5.14.0-611.30.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Feb 11 06:42:00 EST 2026 x86_64
User: elrashedytravel (1025)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/.cpan/build/Test-LeakTrace-0.17-0/t/10_bad_use.t
#!perl -w

use strict;
use Test::More tests => 6;

use Test::LeakTrace;

for(1 .. 2){
	eval{
		my @a = leaked_refs{
			my @b = leaked_refs{
				my %a = (foo => 42);
				my %b = (bar => 3.14);

				$b{a} = \%a;
				$a{b} = \%b;
			};
		};
	};
	isnt $@, '', 'multi leaktrace';

	eval{
		leaktrace{
			my %a = (foo => 42);
			my %b = (bar => 3.14);

			$b{a} = \%a;
			$a{b} = \%b;
		} sub {
			die ['foo'];
		};
	};
	is_deeply $@, ['foo'], 'die in callback';

	eval{
		leaktrace{
			my @array;
			push @array, \@array;
		} -foobar;
	};
	like $@, qr/Invalid reporting mode/, 'invalid mode';
}