Inside CGI.pm,how does thingies like END_OF_FUNC work?
3643 '_compile_al开发者_JS百科l' => <<'END_OF_FUNC',
3644 sub _compile_all {
3645 foreach (@_) {
3646 next if defined(&$_);
3647 $AUTOLOAD = "CGI::$_";
3648 _compile();
3649 }
3650 }
3651 END_OF_FUNC
3652
3653 );
3654 END_OF_AUTOLOAD
3655 ;
How does END_OF_FUNC
and END_OF_AUTOLOAD
work here?
That is here-doc syntax, it is just a way of writing strings.
It's part of the nearly-obsolete AutoLoader
mechanism, which tries to save a tiny amount of time by only defining functions when they're first referenced. It's preserved in CGI
primarily for compatibility reasons; there's no good reason to write any new code this way.
精彩评论