Also don't wrap the code inside a real block, as this changes the behaviour
of last and redo.
my @errs;
my $wrapper = <<" WRAPPER";
- {
return;
package main;
- no indirect hook => sub { push \@errs, [ \@_ ] };
- {
- ;
+ my \$hook;
+ BEGIN { \$hook = sub { push \@errs, [ \@_ ] } }
+ no strict;
+ no warnings;
+ no indirect hook => \$hook;
+ do {
#line 1 "$file"
$src
}
- }
WRAPPER
{
local ($@, *_);
eval $wrapper; ## no critic
- if ($@) {
+ if (my $err = $@) {
require Carp;
- Carp::confess("Couldn't compile the source wrapper: $@");
+ Carp::croak("Couldn't compile the source wrapper: $err");
}
}
my ($tests, $reports, $subtests);
BEGIN {
- $tests = 27;
- $reports = 42;
+ $tests = 28;
+ $reports = 43;
$subtests = 3;
}
my $x = meh { new $obj } new X;
----
[ 'meh', '{', 2, 9 ], [ 'new', '$obj', 2, 15 ], [ 'new', 'X', 2, 26 ]
+####
+my $x = $invalid_global_when_strict_is_on; new X;
+----
+[ 'new', 'X', 1, 44 ]