Plugin bugs discovered during setup of Rhye's Recent Entries

I used Timothy Appnel's mt-rebuild script to automatically update the "Rhye's Recent Entries" list each hour. When I tested mt-rebuild in a cron job, I received notification of 3 errors:

1. Can't locate object method "add_conditonal_tag" via package "MT::Template::Context" (perhaps you forgot to load "MT::Template::Context"?) at /home/dpdave00/public_html/scgi-bin/plugins/entrylist.pl line 29.
Compilation failed in require at /home/dpdave00/public_html/scgi-bin/lib/MT.pm line 117.

This error looked complicated and messy until I looked at the source code in entrylist.pl (code for the MT-EntryList plugin):

27 MT::Template::Context->add_conditional_tag(EntryListNoHeader => \&entrylist_headfoot);
28 MT::Template::Context->add_conditional_tag(EntryListNoFooter => \&entrylist_headfoot);
29 MT::Template::Context->add_conditonal_tag(EntryListEmpty => \&entrylist_empty);

(Line numbers added for clarity)

In line 29, "conditonal" is misspelled. This is easy to see when comparing it to the previous lines, but it's also easy to miss when looking at it by itself. I edited line 29 of entrylist.pl, changing "conditonal" to "conditional" and uploaded the modified file to the server, eliminating this error.

Oddly enough, another user had received this exact error 5 months ago from MT-Medic and posted it to the MT-EntryList page at mt-plugins.org. That post does not seem to have been answered.

2. "my" variable $is_switch masks earlier declaration in same scope at /home/dpdave00/public_html/scgi-bin/plugins/switch.pl line 54.

The cause of this warning is relatively straightforward to see and correct. From switch.pl (code for the MT-Switch plugin):

50 my $is_switch = $ctx->stash('is_switch',1);
51 my $builder = $ctx->stash('builder');
52 my $tokens = $ctx->stash('tokens');
53 my $out = $builder->build($ctx, $tokens);
54 my $is_switch = $ctx->stash('is_switch',0);

(Line numbers added for clarity)

The declaration of "my $is_switch" should only occur once in the same block of code. It is proper when used in line 50, but not proper in line 54. To correct this problem, I deleted the keyword "my" from line 54 then uploaded the modified file to the server.

3. mt-rssfeed: http://rhye32.tweezersedge.com/blog/rss.xml could not be cached as ./db/rss.httprhye32tweezersedgecomblogrssxml. at /home/dpdave00/public_html/scgi-bin/plugins/mt-rssfeed.pl line 391.

This was a configuration problem on my end - the path to where the MT-RSSFeed plugin should store its cached feeds needed to be a full (not relative) path. Editing the $RSSFEEDDATADIR variable in mt-rssfeed.pl corrected this problem.

I thought it was odd that the mt-rebuild script was giving errors in plugins that were not being directly used. My guess is that the mt-rebuild script tries to initialize all plugins before rebuilding any templates, and errors/warnings are not suppressed, leading to the errors I received. Somewhat of a pain to fix, but I'm glad it's working now.