Devel-DebugHooks
view release on metacpan or search on metacpan
t/42-chk_globals.t view on Meta::CPAN
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More 'no_plan';
use Test::Output;
use FindBin qw/ $Bin /; my $lib = "-I$Bin/lib -I$Bin/../lib";
use Data::Section::Simple qw/ get_data_section /;
use Test::Differences;
unified_diff();
{
no warnings qw/ redefine prototype /;
*is = \&eq_or_diff;
}
sub n {
$_ = join '', @_;
s#\t# #gm;
s#(?:[^\s]*?)?([^/]+\.p(?:m|l))#xxx/$1#gm;
$_;
}
sub nl {
$_ = n( @_ );
s#(xxx/.*?pm:)\d+#$1XXXX#gm;
$_;
}
sub nn {
$_ = n( @_ );
s#( at ).*$#$1...#gm; # Remove file:line info
$_;
}
my $cmds;
my $script;
my $files = get_data_section();
($script = <<'PERL') =~ s#^\t##gm;
print sort{
$a <=> $b
} qw/ 3 1 2 /;
PERL
is
n( `$^X $lib -d:DbInteract='off;s 2;\$a;\$b;go' -e '$script'` ) ."\n"
,$files->{ 'anb' }
,"\$a \$b should not be changed by debugger";
SKIP: {
eval { require List::Util };
skip "List::Util is not installed" if $@;
( run in 1.792 second using v1.01-cache-2.11-cpan-6aa56a78535 )