Forum OpenACS Q&A: Response to MP3 Jukebox Perl Dependancy

Collapse
Posted by David Cohen on
The short answer: you can put put the module in a directory that you can write to and then tell Perl where it is.

Read about it here

In this case, I think you should create a subdirectory called MP3 somewhere, put Info.pm in it and then tell Perl where to start looking for the MP3 sub-directory. So, if you set things up like this:

/home/newhook/MP3/Info.pm

you would say:

use lib '/home/newhook';

and so when Perl went looking for library (i.e. module) directories where there was a subdirectory called MP3, it would now find it off of /home/newhook.

Of course, you want to make sure that the "use lib /home/newhook" line appears before the "use MP3::Info.pm" line in the code, since otherwise Perl will try to load the Info.pm module before you tell it that there's a new directory that it should use when looking for modules.

The article above, btw, doesn't mention that you can also add libraries by using the "-I" flag in the first line of the Perl file (i.e. the "shebang" line (shebang = hash-bang = #!)) like this:

#!/usr/bin/perl -I/home/newhook (I forget if you'd need to quote the directory path or not when using -I)

The rest of the error message, btw, tells you what library directories Perl does know about, that is, which directories are in the @INC array. By using one of the techniques above, you will add another directory to the @INC array and so Perl will be able to find Info.pm (btw, .pm = perl module = library).