Plugin Envelope Errors
This is a question I've seen a lot, through emails, bug reports and on the forums. First a little general background information.
The 'Plugin Envelope' method was something introduced with v3.0 and one of the first plugins to use it was MT-Blacklist. This is where a plugin creates its own subdirectory within the main plugins/ directory, for example MT Blacklist has plugins/Blacklist, MT Protect has plugins/Protect and so on.
The problem many people are facing are the hundreds of errors that these plugins spit out and look similar to this:
Plugin error: /home/.../.../cgi-bin/plugins/Blogroll/Blogroll.pl Can't locate Blogroll/Blogroll.pm in @INC (@INC contains: plugins/Blogroll/lib /home/.../.../cgi-bin/plugins/Blacklist/lib ./plugins/Blacklist/l...
I've filed a bug report with Six Apart to make life easier for developers but until then there's an easy way to fix these errors. I'm going to use my MT Protect plugin as an example.
Open up the *.pl file found in the plugin's subfolder under plugins. In the case of MT Protect this would be plugins/Protect/Protect.pl. Look at the very top of that file, the contents may vary but the key part is to see a line beginning use lib. With MT Protect, it looks like this
use lib File::Spec->catdir('plugins','Protect','lib');
Replace that with something like this
use lib File::Spec->catdir('plugins','Protect','lib');
use lib '/full/path/to/plugins/Protect/lib';
Your mileage may vary but I've found that in most cases this fixes the errors.
For developers, until Six Apart issues a fix, if they do, David Phillips suggested using MT->instance like so
use lib File::Spec->catdir('plugins','Protect','lib');
use lib '/full/path/to/plugins/Protect/lib';
require File::Spec;
use lib File::Spec->catdir(MT->instance->{mt_dir}, 'plugins', 'Protect', 'lib');
The only caveat being that MT->instance was only introduced in MT 3.1.

Leave a comment