CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Beginner:
Installing a .pm file

 



tharpa
Novice

Jul 12, 2016, 11:42 AM

Post #1 of 5 (1800 views)
Installing a .pm file Can't Post

We have an old .pm file that was written at least four years ago, and quite possibly much longer. I want to install it locally. I do not have a .gz file for it, and, obviously, it is not available on cpan. Can I install it? How?


BillKSmith
Veteran

Jul 12, 2016, 12:45 PM

Post #2 of 5 (1798 views)
Re: [tharpa] Installing a .pm file [In reply to] Can't Post

Assuming that the file is pure perl code and that it does not use any modules that are not already installed, you have several choices. The best one depends on what you need it for. Is it needed for only one application? Only your own applications? All users of the system? If so, does it have documentation which must be integrated with perl's documentation system?

If it does depend on other modules, you will have to install them (and everything that they depend on). If it (or any of the modules that it requires) contains any code other than perl (usually C) you almost certainly have to find the build file and learn to use it. If you cannot find it, I cannot help you;

Tell us more about your situation.
Good Luck,
Bill


tharpa
Novice

Jul 12, 2016, 12:57 PM

Post #3 of 5 (1797 views)
Re: [BillKSmith] Installing a .pm file [In reply to] Can't Post

Hi, Bill,

We have a venerable old system on the server that is not working right in a particular new case. I want to debug it in Padre. Until I find out otherwise, I am going to assume that the modules are already installed, or that I will get error messages telling me which ones are missing. So if I just knew the procedure for installing a .pm file (in the simplest case), then I could proceed from there.

Although the system does use C, I'm currently willing to assume that this .pm does not call it.


BillKSmith
Veteran

Jul 12, 2016, 3:34 PM

Post #4 of 5 (1793 views)
Re: [tharpa] Installing a .pm file [In reply to] Can't Post

tharpa,

At least while you are debugging, you should "install" questionable modules in a private library. Create a directory (You might as well call it 'lib') in any convenient place. Create an environmental variable "PERL5LIB". Set its value to the full path of your lib. Copy your .pm file into your lib directory. When you use that module, you will get this copy even if it conflicts with another with the same name. No one else will be affected at all.

OK, I skipped one step because I have to remind you of how perl searches for modules. By convention, modules have a double name (e.g. IO::File). Perl changes the '::' to '//' and appends '.pm' to form the file name. The result is that perl searches for a file called File.pm in a subdirectory /IO of any module library.

My directions above work fine if the module name (Refer to the package statement near the beginning of the module) does not have the colons. If it does, you have to create the subdirectory of lib and copy your file into the subdirectory rather than directly into lib.

After you have completed your debugging and identified the modules that you need, You will have to move them to a more permanent home. Lets worry about that latter. With a little luck, you won't need any.
Good Luck,
Bill


tharpa
Novice

Jul 13, 2016, 9:54 AM

Post #5 of 5 (1782 views)
Re: [BillKSmith] Installing a .pm file [In reply to] Can't Post

Thanks, Bill.

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives