1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
#!perl
use strict;
use warnings;
use Test::More;
use Function::Parameters;
my @warnings;
BEGIN {
$SIG{__WARN__} = sub {
push @warnings, $_[0];
};
}
sub wget {
splice @warnings
}
{
BEGIN { $^H{'Function::Parameters/config'} .= ''; }
if (0) {}
if (0) {}
}
BEGIN {
my @w = wget;
is @w, 1;
like $w[0], qr{^Function::Parameters: \$\^H\{'Function::Parameters/config'\} is not a reference; skipping: HASH\(};
}
{
no warnings 'Function::Parameters';
BEGIN { $^H{'Function::Parameters/config'} .= ''; }
if (0) {}
if (0) {}
}
BEGIN {
my @w = wget;
is @w, 0;
is $w[0], undef;
}
done_testing;
|