in reply to Re: Compile-time checking for undef subroutines?
in thread Compile-time checking for undef subroutines?

Well, there's a bit more to that. Remember that in Perl you can call subroutines without using parenthesis. The compiler will only allow that if it knows about such a subroutine - the compiler must have seen either a definition or a declaration of the subroutine; that is, there must be an entry in the namespace stash. This means that when the compiler encounters something that looks like a subroutine (bareword that was declared defined as a sub, bareword followed by parenthesis or a bareword preceeded by &), it knows whether it's at that moment defined or declared.

The reason you state, it can be created at runtime, is the reason the compiler doesn't balk, but postpones it to the runtime environment.

So, the answer is, "yes, the compiler knows, and no, that information isn't available, but if it were, it wouldn't be half as useful as you might think - which is also the reason why it isn't available".

Abigail

  • Comment on Re: Compile-time checking for undef subroutines?

Replies are listed 'Best First'.
Re^2: Compile-time checking for undef subroutines? (extra strict?)
by Aristotle (Chancellor) on May 06, 2003 at 07:24 UTC