Perl Monk, Perl Meditation | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
System specs:
MT 3.16 Windows XP br> ActivePerl 5.8.3 (build 809) Apache 1.3.33 (Win32) mod_perl 1.29_01-dev I have configured my PC to run MT 3.16 under mod_perl using Apache::Registry. The following errors are alternately displayed each time I browse to mt-nofollow.cgi: ***** Error 1 An error occurred: Error opening file 'mt.cfg': No such file or directory ***** Error 2 Can't load error template; got error 'Loading template 'error.tmpl' failed: HTML::Template->new() : Cannot open included file error.tmpl : file not found. at c:/Perl/site/lib/HTML/Template.pm line 1616 HTML::Template::_init_template('HTML::Template=HASH(0x4b12fa4)') called at c:/Perl/site/lib/HTML/Template.pm line 1189 HTML::Template::_init('HTML::Template=HASH(0x4b12fa4)') called at c:/Perl/site/lib/HTML/Template.pm line 1083 HTML::Template::new('HTML::Template','type','filename','source','error.tmpl','path','ARRAY(0x4955708)','search_path_on_include',1,...) called at c:/apache/cgi-bin/mt3/lib/MT/App.pm line 460 eval {...} called at c:/apache/cgi-bin/mt3/lib/MT/App.pm line 459 MT::App::load_tmpl('MT::App::SpamLookup=HASH(0x4ac1b2c)','error.tmpl') called at c:/apache/cgi-bin/mt3/lib/MT/App.pm line 295 MT::App::show_error('MT::App::SpamLookup=HASH(0x4ac1b2c)','') called at c:/apache/cgi-bin/mt3/lib/MT/App.pm line 376 MT::App::run('MT::App::SpamLookup=HASH(0x4ac1b2c)') called at c:/apache/cgi-bin/mt3/plugins/spamlookup/mt-spamlookup.cgi line 895 eval {...} called at c:/apache/cgi-bin/mt3/plugins/spamlookup/mt-spamlookup.cgi line 889 Apache::ROOT::cgi_2dbin::mt3::plugins::spamlookup::mt_2dspamlookup_2ecgi::handler('Apache=SCALAR(0x4b12f98)') called at c:/Perl/site/lib/Apache/Registry.pm line 149 eval {...} called at c:/Perl/site/lib/Apache/Registry.pm line 149 Apache::Registry::handler('Apache=SCALAR(0x4b12f98)') called at nul line 0 eval {...} called at nul line 0 '. Giving up. Original error was Can't call method "parse" on an undefined value at c:/apache/cgi-bin/mt3/lib/MT/App.pm line 314. ***** I believe there are 2 issues with the code in mt-nofollow.cgi which cause the above errors and prevent mt-spamlookup.cgi from working under mod_perl: 1) The code that determines the location of the MT directory ($MT_DIR) then adds MT's lib and extlib directories to @INC (lines 14-37) should be enclosed within a BEGIN block, like what is used in MT's cgi scripts. 2) At line 18 in mt-spamlookup.cgi, the code begins to determine the MT directory by evaluating $ENV{PWD}. When not running under mod_perl, $ENV{PWD} does not return any value on my machine (PWD is not set?), and the subsequent lines of code use other means to properly identify my MT directory. However, when running under mod_perl, $ENV{PWD} returns the path to my Apache directory (c:/apache). Even though MT is not installed in my c:/apache directory, the subsequent lines of code only check whether the path is an absolute path (which c:/apache is). The directory where MT is installed is thus never properly determined, I've commented out line 18 in my copy of mt-spamlookup.cgi - both dirname($0) and dirname($ENV{SCRIPT_FILENAME}) return the correct path to my MT installation (c:/apache/cgi-bin/mt3). If checking $ENV{PWD} is necessary, it appears to me that it should not be looked at first to determine the MT directory, or the path returned should be subjected to more testing before accepting it as the MT directory. I had a minor question about lines 33-34 in mt-nofollow.cgi: I have replaced lines 33-34 in mt-spamlookup.cgi with the above code, but I don't know if it is really better, or if it's not really necessary. 2006-10-08 Unapproved by planetscape once evidence of habitual plagiarism uncovered.
Considered by hossman: plagarism
|
|