Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is difference between installing a perl module and copying whole folder?

I have installed a perl module, say XYZ then a folder is created that contains many .pm files. I copied the folder and put it in any other system where XYZ is not installed.

So, I'm able to use methods of XYZ module in both system. I mean, I'm unable to find out the difference between these method, but I think there must be some. What I know is, when we install a perl module then dependencies also gets installed. Am I right? Can anyone mention other difference between two, if any?

like image 835
Kamal Nayan Avatar asked Dec 09 '15 07:12

Kamal Nayan


People also ask

What is the difference between a .pl and .pm file?

pl is a single script. In . pm (Perl Module) you have functions that you can use from other Perl scripts: A Perl module is a self-contained piece of Perl code that can be used by a Perl program or by other Perl modules.

What is the use of Perl modules?

A module in Perl is a collection of related subroutines and variables that perform a set of programming tasks. Perl Modules are reusable. Various Perl modules are available on the Comprehensive Perl Archive Network (CPAN).

Where are Perl modules installed?

You need to use instmodsh (interactive inventory for installed Perl modules) command to find out what modules already installed on my system. instmodsh command provides an interactive shell type interface to query details of locally installed Perl modules.


1 Answers

A few off the top of my head:

  • In case of an XS module, the code is compiled for the local platform.
  • Installing a module via cpan usually runs the test suite so if there is any other reason beyond dependencies why it wouldn't work, you're told so (I guess that's very rare though)
  • Regular installation automatically goes to a directory where your perl can find modules.

Of course you can take care of all these yourself. These days chances are pretty good you're running either Linux or Windows on something x86-ish and as long as you only copy Linux to Linux and Windows to Windows, and to the same place as on the source system, you'll be fine. Basically that's what binary Linux distributions and ActivePerl packages do, too, and it may make sense e.g. if you want to avoid installing a whole bunch of compile-time dependencies on all target systems. Just make sure you don't get yourself into a mess by writing to system directories (e.g. /usr/share/perl5) that are supposed to be managed by your system's package manager.

like image 183
mbethke Avatar answered Sep 21 '22 11:09

mbethke