Branch: refs/heads/blead
Home: https://github.com/Perl/perl5
Commit: 6cbecd64808994307a24b545e7272225bf0fca35
https://github.com/Perl/perl5/commit/6cbecd64808994307a24b545e7272225bf0fca35
Author: Richard Leach <[email protected]>
Date: 2025-01-21 (Tue, 21 Jan 2025)
Changed paths:
M pp_hot.c
Log Message:
-----------
Move pp_entersub DIE() code into S_croak_undefined_subroutine
In `pp_entersub`, when trying to find the subroutine `CV` to execute,
there are three nearby code paths that can result in a `DIE()`. This
commit extracts the DIE() logic to a helper subroutine,
`S_croak_undefined_subroutine`. This is partly in anticipation of
additional warning logic, but also generally reduces the size of this
hot function.
Commit: e1cbf0234f7fa21eefe0a3efa6c99a297cfcf5fb
https://github.com/Perl/perl5/commit/e1cbf0234f7fa21eefe0a3efa6c99a297cfcf5fb
Author: Richard Leach <[email protected]>
Date: 2025-01-21 (Tue, 21 Jan 2025)
Changed paths:
M pod/perldelta.pod
M pod/perldiag.pod
M pp_hot.c
M t/lib/croak/pp_hot
Log Message:
-----------
Undefined subroutine &%s called, close to label '%s'
https://github.com/Perl/perl5/issues/17839 requested a compile-time
warning for the situation whereby a single colon is accdentally typed
as a package separator when calling a function. For example:
```
package BOOP;
sub beep;
package main;
BOOP:beep(); # Meant to be BOOP::beep();
```
However, because of both Perl's syntax and the potential to populate the
stash at runtime, this falls somewhere between very difficult and
impossible. As an alternative, some enhanced fatal error wording was
requested and this commit attempts to provide that.
The above example would previously die with the message:
```
Undefined subroutine &main::beep called at ... line 4.
```
Now it dies with the message:
```
Undefined subroutine &main::beep called, close to label 'BOOP' at ... line 4.
```
For some of the same reasons mentioned, distinguishing this typo from
other errors at runtime - such as the target subroutine not being
present at all - is also nigh on impossible. The hope is that the
error message will give some additional clue when the error is the
result of a typo, without distracting the user in all other cases.
Compare: https://github.com/Perl/perl5/compare/3ed37686f314...e1cbf0234f7f
To unsubscribe from these emails, change your notification settings at
https://github.com/Perl/perl5/settings/notifications