You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Undefined subroutine &%s called, close to label '%s'
#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.
0 commit comments