Perl always expects each :: in a module name to translate to a path separator in the directory hierarchy. So for the module Script::Singleton it will look for the file Singleton.pm in a subdirectory named Script underneath one of the directories specified in @INC.
So if you want to reference it from /home/demo/pullWorkload/scpLRSIControllerDir/toys, you need to create /home/demo/pullWorkload/scpLRSIControllerDir/toys/Script (with mkdir), and put the file Singleton.pm in that directory.
I would recommend this as a temporary solution only. For CPAN modules it is almost always preferable to keep them in a separate place - see other people's suggestions for how to do that.
The handling of :: in module names is not trivial to find in the documentation. From perldoc -f use you will see that use Script::Singleton; is exactly equivalent to BEGIN { require Script::Singleton; Script::Singleton->import(); }. You then need to understand that since Script::Singleton is not in quotes, it is what perl calls a "bareword", and then find the part of perldoc -f require that describes this:
If EXPR is a bareword, "require" assumes a .pm extension a +nd replaces "::" with "/" in the filename for you, to make it + easy to load standard modules.
In reply to Re^3: Modules 101 :: Using a Local Module from CPAN
by hv
in thread Modules 101 :: Using a Local Module from CPAN
by redapplesonly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |