From: Vincent Pit Date: Mon, 16 Nov 2026 10:09:46 +0000 (+0100) Subject: Adjust line number test for exception thrown from anonymous sub X-Git-Tag: rt181699^0 X-Git-Url: http://git.vpit.fr/?a=commitdiff_plain;h=bff7fa31dd8757831ee5c47e0653f43063e85a82;p=perl%2Fmodules%2FScope-Upper.git Adjust line number test for exception thrown from anonymous sub The parser has been fixed in perl 5.45.4 to report the line number for the sub keyword rather than the end of the anonymous sub. Thansk Richard Leach for reporting and suggesting a fix. This fixes [RT #181699] --- diff --git a/t/63-uplevel-ctl.t b/t/63-uplevel-ctl.t index fba2a68..8d6cbb1 100644 --- a/t/63-uplevel-ctl.t +++ b/t/63-uplevel-ctl.t @@ -314,14 +314,15 @@ sub clash { # XS { - my $desc = 'exception thrown from XS'; + my $desc = 'exception thrown from XS'; + my $offset = "$]" >= 5.045004 ? 4 : 2; # Exception fires at target frame local $@; eval { sub { &uplevel(\&uplevel => \1, HERE); }->(); }; - my $line = $^P ? '\d+' : __LINE__-2; # The error happens at the target frame. + my $line = $^P ? '\d+' : __LINE__ - $offset; my $file = $^P ? '\S+' : quotemeta $0; like $@, qr/^First argument to uplevel must be a code reference at $file line $line/,