# File lib/pluginfactory.rb, line 351
        def require_derivative( mod_name )

                # See if we have a list of special subdirs that derivatives
                # live in
                if ( self.respond_to?(:derivative_dirs) )
                        subdirs = self.derivative_dirs

                elsif ( self.respond_to?(:derivativeDirs) )
                        subdirs = self.derivativeDirs

                # If not, just try requiring it from $LOAD_PATH
                else
                        subdirs = ['']
                end

                subdirs = [ subdirs ] unless subdirs.is_a?( Array )
                PluginFactory.log.debug "Subdirs are: %p" % [subdirs]
                fatals = []
                tries  = []

                # Iterate over the subdirs until we successfully require a
                # module.
                subdirs.collect {|dir| dir.strip}.each do |subdir|
                        self.make_require_path( mod_name, subdir ).each do |path|
                                PluginFactory.log.debug "Trying #{path}..."
                                tries << path

                                # Try to require the module, saving errors and jumping
                                # out of the catch block on success.
                                begin
                                        require( path.untaint )
                                rescue LoadError => err
                                        PluginFactory.log.debug "No module at '%s', trying the next alternative: '%s'" %
                                                [ path, err.message ]
                                rescue Exception => err
                                        fatals << err
                                        PluginFactory.log.error "Found '#{path}', but encountered an error: %s\n\t%s" %
                                                [ err.message, err.backtrace.join("\n\t") ]
                                else
                                        PluginFactory.log.info "Loaded '#{path}' without error."
                                        return path
                                end
                        end
                end

                PluginFactory.log.debug "fatals = %p" % [ fatals ]

                # Re-raise is there was a file found, but it didn't load for
                # some reason.
                if fatals.empty?
                        errmsg = "Couldn't find a %s named '%s': tried %p" % [
                                self.factory_type,
                                mod_name,
                                tries
                          ]
                        PluginFactory.log.error( errmsg )
                        raise FactoryError, errmsg
                else
                        PluginFactory.log.debug "Re-raising first fatal error"
                        Kernel.raise( fatals.first )
                end
        end