- Notifications
You must be signed in to change notification settings - Fork587
Commite1cbf02
committed
Undefined subroutine &%s called, close to label '%s'
#17839 requested a compile-timewarning for the situation whereby a single colon is accdentally typedas 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 thestash at runtime, this falls somewhere between very difficult andimpossible. As an alternative, some enhanced fatal error wording wasrequested 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 fromother errors at runtime - such as the target subroutine not beingpresent at all - is also nigh on impossible. The hope is that theerror message will give some additional clue when the error is theresult of a typo, without distracting the user in all other cases.1 parent6cbecd6 commite1cbf02
4 files changed
+39
-0
lines changedLines changed: 12 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
196 | 196 |
| |
197 | 197 |
| |
198 | 198 |
| |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
199 | 211 |
| |
200 | 212 |
| |
201 | 213 |
| |
|
Lines changed: 10 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6820 | 6820 |
| |
6821 | 6821 |
| |
6822 | 6822 |
| |
| 6823 | + | |
| 6824 | + | |
| 6825 | + | |
| 6826 | + | |
| 6827 | + | |
| 6828 | + | |
| 6829 | + | |
| 6830 | + | |
| 6831 | + | |
| 6832 | + | |
6823 | 6833 |
| |
6824 | 6834 |
| |
6825 | 6835 |
| |
|
Lines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6228 | 6228 |
| |
6229 | 6229 |
| |
6230 | 6230 |
| |
| 6231 | + | |
| 6232 | + | |
| 6233 | + | |
| 6234 | + | |
| 6235 | + | |
| 6236 | + | |
| 6237 | + | |
| 6238 | + | |
6231 | 6239 |
| |
6232 | 6240 |
| |
6233 | 6241 |
| |
|
Lines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
45 | 45 |
| |
46 | 46 |
| |
47 | 47 |
| |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
48 | 57 |
| |
49 | 58 |
| |
50 | 59 |
| |
|
0 commit comments
Comments
(0)