in reply to Re: Namespace and use confusion. "Undefined subroutine errors"
in thread Namespace and use confusion. "Undefined subroutine errors"

The simple answer is don't do that! Modules calling each other or calling themselves are usually a sign of bad design.
... and when that happens, I take it as a sign that you always want both of your source files always to be loaded together. So why put them in separate files? Simply put them together in the same module. Perl does not enforce packages being in the source file as indicated by the package name. It's best to have that package in the source too, as a sanity handle, and to avoid confusion, and otherwise import won't work either; but it's not absolutely required.

See (the source of) XML::Parser for example, where multiple packages are put into the same module — an example where they might just as well, or maybe even better, have used separate files.

  • Comment on Re^2: Namespace and use confusion. "Undefined subroutine errors"