still warn on UNIVERSAL->import(@args)
do not warn on UNIVERSAL->import; this means "use UNIVERSAL;" is
still accepted without warning (for better or worse)
# anything unless called on UNIVERSAL.
sub import {
return unless $_[0] eq __PACKAGE__;
+ return unless @_ > 1;
require warnings;
warnings::warnif(
'deprecated',
require "./test.pl";
}
-plan tests => 123;
+plan tests => 124;
$a = {};
bless $a, "Bob";
{
my $m;
local $SIG{__WARN__} = sub { $m = $_[0] };
- eval "use UNIVERSAL";
+ eval "use UNIVERSAL 'can'";
like($m, qr/^UNIVERSAL->import is deprecated/,
- "deprecation warning for UNIVERSAL->import");
+ "deprecation warning for UNIVERSAL->import('can')");
+
+ undef $m;
+ eval "use UNIVERSAL";
+ is($m, undef,
+ "no deprecation warning for UNIVERSAL->import");
}
# Test: [perl #66112]: change @ISA inside sub isa