|Problems? Is your data what you think it is?|
Re: Cannot call my installed moduleby 7stud (Deacon)
|on Feb 24, 2013 at 04:18 UTC||Need Help??|
# Why is Exporter white while other use # statements are colored
I don't know, but I can confirm that the same thing happens in macvim with the vividchalk color scheme:
Experimenting with different modules, it appears that lower case builtin modules appear in orange, while any upper case module name is white.
Note that @INC contains the list of directories that perl will search for modules--that you use. There are lots of modules in those directories, but perl will only load them into your program, if you use them. If you look at the use docs, the statement 'use Module' is equivalent to:
What does that mean? Well require() does this:
...require demands that a library file be included if it hasn't already been included. The file is included via the do-FILE mechanism, which is essentially just a variety of eval...
Which means that perl searches the directories in @INC for the specified Module, and if found perl then evals the text file converting it into code. After the require, perl calls a subroutine named import() that is defined in Module. Typically, the import() method creates aliases in the caller (i.e your perl program) for the subroutines defined in the Module--which allows your program to call the subroutines. The following lines in your program take care of the aliasing for you:
If you are worried about the subroutine names in the Module clashing with names in your perl program, you can write:
And thereafter, you can refer to the subroutines by their fully qualified names, e.g. Dir::Module::subroutine_name
But perl cannot see the subroutines defined in a text file just because the text file resides in a directory in @INC. You have to convert the text file to code with use/require. Your 'use lib' just adds a directory to @INC.