diff --git a/include/znc/FileUtils.h b/include/znc/FileUtils.h index f8d37880..e2be4e9a 100644 --- a/include/znc/FileUtils.h +++ b/include/znc/FileUtils.h @@ -187,7 +187,7 @@ public: continue; } - CFile *file = new CFile(sDir + "/" + de->d_name/*, this*/); // @todo need to pass pointer to 'this' if we want to do Sort() + CFile *file = new CFile(sDir.TrimSuffix_n("/") + "/" + de->d_name/*, this*/); // @todo need to pass pointer to 'this' if we want to do Sort() push_back(file); } diff --git a/modules/modperl.cpp b/modules/modperl.cpp index e305063a..56977ecc 100644 --- a/modules/modperl.cpp +++ b/modules/modperl.cpp @@ -211,7 +211,9 @@ public: PUSH_STR(sName); PUSH_PTR(CModInfo*, &ModInfo); PCALL("ZNC::Core::ModInfoByPath"); - if (!SvTRUE(ERRSV)) { + if (SvTRUE(ERRSV)) { + DEBUG(__PRETTY_FUNCTION__ << ": " << sPath << ": " << PString(ERRSV)); + } else if (ModInfo.SupportsType(eType)) { ssMods.insert(ModInfo); } PEND; diff --git a/modules/modperl/startup.pl b/modules/modperl/startup.pl index f357a421..52bbf67f 100644 --- a/modules/modperl/startup.pl +++ b/modules/modperl/startup.pl @@ -162,6 +162,11 @@ sub ModInfoByPath { $modinfo->SetName($modname); $modinfo->SetPath($modpath); $modinfo->AddType($_) for @types; + unless ($modrefcount{$modname}) { + say "Unloading $modpath from perl, because it's not loaded as a module"; + ZNC::_CleanupStash($modname); + delete $INC{$modpath}; + } } sub CallModFunc {