mt.cgi starts with the following code:
CODE
use strict;
my($MT_DIR);
BEGIN {
if ($0 =~ m!(.*[/\])!) {
$MT_DIR = $1;
} else {
$MT_DIR = './';
}
unshift @INC, $MT_DIR . 'lib';
unshift @INC, $MT_DIR . 'extlib';
}
my($MT_DIR);
BEGIN {
if ($0 =~ m!(.*[/\])!) {
$MT_DIR = $1;
} else {
$MT_DIR = './';
}
unshift @INC, $MT_DIR . 'lib';
unshift @INC, $MT_DIR . 'extlib';
}
mod_perl does not always interpret BEGIN blocks on every request. That means that the above, highly essential code will not get interpreted on every page request to a server using mod_perl. This will result in errors like 'Can't find MT::SomeModule [spits out @INC]' that only occur sporadically.
I don't see, upon my cursory inspection, any compelling reason to keep this code in a BEGIN block -- beyond belt-and-suspenders issues, of course. But considering that it isn't quite compatible with mod_perl, wouldn't it be more portable to keep the code outside the BEGIN block?
Thanks for your time and interest. I hope this post is useful.