We don't bite newbies here... much | |
PerlMonks |
Re: help with versioning modulesby afoken (Chancellor) |
on Nov 20, 2020 at 19:20 UTC ( [id://11123922]=note: print w/replies, xml ) | Need Help?? |
use expect a bareword, not a string. Period. If you want module names that are not barewords, you are already begging for trouble, as package expects a namespace, not a string. Anyway, it is possible to load a module from such "unperlish" names. This is slightly hidden in use:
require allows to use a bareword, but you can alternatively provide a filename to be loaded. To generate a filename from a bareword, convert all :: and ' to / and append .pm. BUTI think the idea to load several versions of the same module into the same namespace is really, really begging for trouble. There may be reasons for having versioned module name spaces, for example to support APIs or protocols with different versions. Consider an imaginary set of HTTP protocol modules:
Note that version numbers were changed to allow their use in barewords. Also note that those modules would load into different namespaces. Alexander
-- Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
In Section
Seekers of Perl Wisdom
|
|