-if ( $plugin_dir and opendir PLUGINS, $plugin_dir ) {
- unshift @INC, $plugin_dir;
- foreach my $plugin ( grep { /^[\w:]+$/ && -f "$plugin_dir/$_" } sort readdir(PLUGINS) ) {
- next if ($plugin =~ /~$/); # Ignore emacs backups
- my($plugin_name, $off) = $plugin =~ /^\d*([\w:]+?)(_?)$/;
- my $on_off = $off eq '_' ? -1 : 1;
- # Allow perl module plugins
- if ($plugin =~ m/::/ && -z "$plugin_dir/$plugin") {
- # For Blosxom::Plugin::Foo style plugins, we need to use a string require
- eval "require $plugin_name";
- }
- else {
- eval { require $plugin };
- }
- $@ and warn "error finding or loading blosxom plugin $plugin_name - skipping\n" and next;
- $plugin_name->start() and ( $plugins{$plugin_name} = $on_off ) and push @plugins, $plugin_name;
- }
- shift @INC;
+my @plugin_list = ();
+
+# If $plugin_list is set, read plugins to use from that file
+$plugin_list = "$config_dir/$plugin_list"
+ if $plugin_list && $plugin_list !~ m!^\s*/!;
+if ( $plugin_list and -r $plugin_list and $fh->open("< $plugin_list") ) {
+ @plugin_list = map { chomp $_; $_ } grep { /\S/ && ! /^#/ } <$fh>;
+ $fh->close;
+}
+# Otherwise walk $plugin_dir to get list of plugins to use
+elsif ( $plugin_dir and opendir PLUGINS, $plugin_dir ) {
+ @plugin_list = grep { /^[\w:]+$/ && ! /~$/ && -f "$plugin_dir/$_" } sort readdir(PLUGINS);