Proposed feature: die on compile with undefined functions
[email protected] (David Condon)
| Newsgroups | perl.perl5.porters |
|---|---|
| Message-ID | <CAFU=p1nsnVuauwKUTV+rPeDXfLkm1_pB6yDmeg3vg7VQHqfAjA@mail.gmail.com> |
Hello, *1. Here is a problem* Scripts that have undeclared subroutines will run, even though the subroutines are not declared/loaded/whatever: use strict; use autodie ':all'; use warnings FATAL => 'all'; print "code is running\n"; #... very long code that takes hours to run my @x = (1,2,3); my $m = max(@x); *2. Here is the syntax that I'm proposing* There are no syntax changes. The only change is that undefined subroutines would be treated the same way that undefined scalars are treated. I want perl to check for the undefined function max before running the script, similarly to the way that this 1-line script: print "$x\n"; would die before execution with the error: Global symbol "$x" requires explicit package name (did you forget to declare "my $x"?) at die.sooner.pl line 8. *3. Here are the benefits of this* This change would cause scripts that will certainly die anyway, to die before running, thus saving (potentially a lot of) time. *4. Here are potential problems* I am unaware of any. I just want something that will happen anyway to happen sooner to save time. This change *shouldn't *be buggy.