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:
use strict;
use warnings;
sub f($) {}
f(2, 3)
Too many arguments for main::f
If we try to call f too early we will get another useful warning:
use strict;
use warnings;
f(2, 3)
sub f($) {}
main::f() called too early to check prototype
This will result in error:
use strict;
use warnings;
sub f($) {}
sub g() { f(2, 3) }
Too many arguments for main::f
And my question is if we can get such message for the following scenario:
use strict;
use warnings;
sub g() { f(2, 3) }
sub f($) {}
Because I do not get any error or warning here. It would be good if I could prevent this code from compiling. Please advise.