Beefy Boxes and Bandwidth Generously Provided by pair Networks
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:

$PLUGIN_DIR = $MT_DIR;<br> ($MT_DIR, $PLUGIN_ENVELOPE) = $MT_DIR =~ m|(.*[\\/])(plugins[\\/].*)$| +i;<br> The sltool script included with SpamLookup seems to use more robust co +de: <br><br> if ($MT_DIR =~ m!plugins[\\/]!) {<br> $PLUGIN_DIR = $MT_DIR;<br> ($MT_DIR, $PLUGIN_ENVELOPE) = $MT_DIR =~ m|(.*[\\/])(plugins[\\/]. +*)?$|i;<br> }<br> $MT_DIR .= '/' unless $MT_DIR =~ m![\\/]$!;<br>
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
Unconsidered by planetscape: keep (and edit) votes prevented reaping ( keep:4 edit:7 reap:20 )


In reply to mt-spamlookup.cgi displays errors running under mod_perl by madtoperl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-20 03:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found