use strict;
use warnings;
-use Test::More tests => 30 * 2;
+use Test::More tests => 30 * 2 + 2;
my ($obj, $x);
}
}
+eval {
+ no indirect 'hlagh';
+ my $warn;
+ local $SIG{__WARN__} = sub { $warn = join ' ', @_ };
+ eval "die qq{the code compiled but it shouldn't have\n}; \$obj = new Hlagh1;";
+ like($warn, qr/^Indirect\s+call\s+of\s+method\s+"new"\s+on\s+object\s+"Hlagh1"/, 'no indirect "hlagh" enables the pragma');
+ eval "die qq{the code compiled but it shouldn't have\n}; \$obj = new Hlagh2;";
+ like($warn, qr/^Indirect\s+call\s+of\s+method\s+"new"\s+on\s+object\s+"Hlagh2"/, 'no indirect "hlagh" doesn\'t croak');
+}
+
__DATA__
$obj = new Hlagh;
####