The block on the bottom is importing symbols from CGI. Unfortunately, you are trying to use header
before executing this block to import it. You need to execute the imports before all uses of header
and such.
Note that
*header = sub { return CGI::header(@_); };
is better written as
*header = &CGI::header
as it avoids a needless extra sub call.
Note that you can ask CGI.pm to export those symbols for you. Instead of manually importing the symbols, you can simply use either of following:
use CGI qw( header path_info url script_name );
use CGI qw( :cgi );
No need to clunckily import the symbols yourself.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…