in reply to Re^2: Module not loading completely?
in thread Module not loading completely?

One scenario where the message "Subroutine xyz redefined ..." appears for every function in a Module, is when you have the module on a case insensitive filesystem (such as FAT32) and you required/used it with the wrong case. For example:
# script.pl: use XML::twig; # wrong case, should be XML::Twig # some Module used by script.pl: use XML::Twig;
If you write it with differing upper-/lowercase, then Perl considers them to be different files. As such loading twig.pm and Twig.pm. This works due to the case insensitive filesystem. Since it is however the same file, and it is loaded twice, it will cause all the functions of the package to be redefined. If you 'use' or 'require' the Module with the proper case, then it is only loaded once, and the error will go away.

You say the error message is:
Undefined subroutine &Module::subroutine called at /home/path/module. +pm line 128, <FILE> line 30.
The filename of a Module should typically be the same as the package name (case sensitive!). Check that the package name matches the filename. Also check that the case of &Module::subroutine is correct. &module::subroutine is not the same as &Module::subroutine.

Replies are listed 'Best First'.
Re^4: Module not loading completely?
by ric00015 (Beadle) on Oct 30, 2013 at 15:35 UTC

    Thanks for responding.

    First, I am on Red Hat Linux, so the case-insensitive issue is not a problem. This program will never be run on Windows either.

    Second, the case used in my error message is kind of moot, as they are separate modules. (I also edited out the names of the actual modules used, as they are considered proprietary information for work.) I should have specified that earlier. Thanks for pointing it out. The revised error would look something like this:

    Undefined subroutine &ONE::Module::subroutine called at /home/path/Other_module.pm line 128, <FILE> line 30.

    And not only that, but only 9 of at least 15 functions are redefined. It seems like the module is only partially loading.