Is dl_load_file called or not here?
unless defined(&dl_load_fi开发者_StackOverflow社区le);
The above looks ambiguous to me but actually works .
How does Perl know whether or not to call dl_load_file
here?
It's just a special case in Perl's syntax. If you have either defined(&identifier)
or defined &identifier
, it checks for the existence of a subroutine named identifier
without calling it, even though &identifier
would normally call the subroutine.
defined &identifier()
, on the other hand, does call the subroutine and then test its return value. The parens after identifier make it a function call.
I think there is not a call - is just a check to see if that function is defined or not
Perl interpreter knows this with the help of Symbol Tables
精彩评论