B
Brian McCauley
Augustus said:I am using perl 5.005 on solaris 8.0. I have also tried this with 5.8.x
on linux.
Here is my problem.
I am trying to use AutoLoader functionality in one of my modules.
I have put
use AutoLoader 'AUTOLOAD' ;
and my functions (e.g. testProc) after __END__ in my module file.
I generated the module by h2xs -Xn myModule
then edited the myModule/myModule.pm with the the data above.
After that perl Makefile.pl PREFIX=$HOME/myPerlModules
After that "make install", which installs the module in
$HOME/myPerlModules.
It also creates the auto/myModules dir with the necessary files under
$HOME/myPerlModules.
Now in my script I do
use lib '/home/user/myPerlModules' ;
use AutoLoader 'AUTOLOAD' ;
testProc("123");
I get the message
Can't localte auto/main/testProc.al in @INC ....
My question is , why is it looking for auto/main instead of auto/testProc ?
Becuase it was main that installed AutoLoader. There is nothing in your
script that even mentioned myModule.
You need to use myModule not AutoLoader in your script. For example see
any module that uses AutoLoader.
I also tried myModule::testProc , but I get can't locate
myModule/testProc.pm
I do not believe you.
I also tried
use myModule 'testProc' ; But I get testProc is not exported. I haven't
added testProc to @EXPORT or @EXPORT_OK, but I thought with AutoLoader it
is not needed.
You thought wrong.
So what am I missing here ?
It's not so much that you are missing something but that you are seeing
something that is not there. The AutoLoader and Exporter menchanisms
are more-or-less orthogonal.