in reply to beginner - can't load a module

I posted the original question. I should have pointed out that the file ExecuteConfigureBioMartBuilder is in the bin directory along with the script I am trying to run. So the fact that the current working directory is in the @inc path means that this file should have been found doesnt it?

Replies are listed 'Best First'.
Re^2: beginner - can't load a module
by Corion (Patriarch) on Oct 16, 2010 at 21:53 UTC

    Perl is looking for bin/ExecuteConfigureBioMartBuilder.pm in its error message. But there only is ./ExecuteConfigureBioMartBuilder.pm. You need to put the module into a bin/ directory or put both, the module and the script into a bin/ directory and launch the script from one level higher.

      This is what i thought but I couldn't get it to work. I created a bin directory in my current directory and copied the file there and it still couldn't find it. I made a bin directory in c:\perl\site\lib and copied the file there and it could find it. I don't understand why the second option worked but the first option failed. The disturbing thing though is that the people who I got these files from are adamant in their installation instructions that you should not move/copy files under any circumstances

        So, as you didn't post any details, let me make some assumptions. You have a directory tree that looks like this:

        C:/Documents and Settings/Administrator/Desktop/Code/BioPerl/testscrip +t.pl C:/Documents and Settings/Administrator/Desktop/Code/BioPerl/ExecuteCo +nfigureBioMartBuilder.pm

        But looking at the code, there are some errors in it. First of all, the code is invalid, because it uses qw() and you have a path with whitespace in directory/filenames. Change that to:

        use lib 'C:/Documents and Settings/Administrator/Desktop/Code/BioPerl/ +';

        Second, if you use lib, Perl will search modules in and below that directory. And the use statement:

        use bin::ExecuteConfigureBioMartBuilder;

        tells Perl to go looking for a file bin/ExecuteConfigureBioMartBuilder.pm. And it can't find that. So, change your tree to look like the following for example:

        C:/Documents and Settings/Administrator/Desktop/Code/BioPerl/testscrip +t.pl C:/Documents and Settings/Administrator/Desktop/Code/BioPerl/bin/Execu +teConfigureBioMartBuilder.pm

        Then, Perl should find the module.