title: Is it possible to prevent forward undeclared function calls in perl?
body: <p>Perl has limited support for static code checking, in particular it can check whether we pass appropriate number of argument to a function. For example this will result in error:</p>
  
  <pre><code>use strict;
  use warnings;
  sub f($) {}
  f(2, 3)
  
  Too many arguments for main::f
  </code></pre>
  
  <p>If we try to call f too early we will get another useful warning:</p>
  
  <pre><code>use strict;
  use warnings;
  f(2, 3)
  sub f($) {}
  
  main::f() called too early to check prototype
  </code></pre>
  
  <p>This will result in error:</p>
  
  <pre><code>use strict;
  use warnings;
  sub f($) {}
  sub g() { f(2, 3) }
  
  Too many arguments for main::f
  </code></pre>
  
  <p>And my question is if we can get such message for the following scenario:</p>
  
  <pre><code>use strict;
  use warnings;
  sub g() { f(2, 3) }
  sub f($) {}
  </code></pre>
  
  <p>Because I do not get any error or warning here. It would be good if I could prevent this code from compiling. Please advise.</p>