tags:

views:

1783

answers:

8

Is it possible?

+6  A: 

If you download the source code, it will generally have a Makefile.PL. You run "perl Makefile.PL; make; make test; make install" and it will build and install for you.

Obviously if you're not using CPAN.pm, you're going to have to deal with dependencies yourself.

Also, if the reason you can't use CPAN.pm is that you don't have permission to install into /usr/lib/perl, you can force CPAN.pm to install locally, but I forget how.

Paul Tomblin
Or for Module::Build based distributions: perl Build.PL; perl Build; perl Build test; perl Build install
ysth
Running "o conf init" in the CPAN shell is the simplest way to reconfigure the whole thing.
Schwern
You can set the value for both makepl_arg and buildpl_arg to set any values you'd like at build time. See the CPAN.pm documentation.
brian d foy
A: 

If the .pm file is pure Perl and doesn't need to be compiled you can just put it in your application's lib folder and use it as normal.

Ben S
To clarify, it should be your application's lib folder, not your system perl lib folder. Manually adding files to your system perl lib is just begging for dependency hell later on.
denkfaul
Good point, editted my answer. I've placed .pms in the perl libs folder, but I had developed them and they had no dependencies :D
Ben S
I have UserAgent.pm.I can just put it in the program's folder? What if it has dependencies?
lamcro
Then you'll have dependency hell, and have to hunt those down. See the installation notes for the library you're trying to install. Know that it's not recommended to do it this way.
Ben S
Don't tell the kids to do this please. You don't run the tests. You don't resolve dependencies. You don't know if the build process does anything to the .pm files. You don't know if there's other associated files (programs, configs, etc...). Don't do this unless you know what you're doing.
Schwern
Ben S
+21  A: 

If you download the source code, and read the README file. This will probably tell you you should do

perl Makefile.PL
make
make test
make install

or

perl Build.PL
./Build
./Build test
./Build install
Leon Timmermans
+1  A: 

If the problem is no root access, I would recommend looking at local::lib and also this webpage for CPAN.pm and non-root installation.

But to answer the question as asked, CPAN or CPANPLUS are helpful, but they aren't required. You can always do it the old-fashioned way as Leon says - though usually it's easier not to.

Telemachus
You can also just run "o conf init" to redo the full CPAN configuration.
Schwern
So long as you have decent a compiler and access to make,you can bootstrap local::lib into your home directory and no root access is required at all. On the other hand, I've seen solaris boxes with pretty heavily locked-down compilers that limit the usefulness of this approach.
singingfish
+3  A: 

If you are on a Linux box, a very large portion of the packages can usually be obtained using the built in package manager. For instance, on an Ubuntu system, if you want to install the PostgreSQL Perl module you'd simple do:

sudo apt-get install libpg-perl

You can see a list of the modules for Ubuntu here: http://packages.ubuntu.com/hardy/perl/

I find I can often guess at the names myself. Not sure if this helps at all, but for myself I often find this easier to use than CPAN as it does a lot better at resolving dependencies.

Morinar
The problem is that this installs to your system Perl. Often you don't want that, even if you think you do.
brian d foy
A: 

If you are using Red Hat (Fedora, CentOS), you should use RPM for Perl dependencies wherever possible. Perl packages are almost always named perl-Module-Name, e.g. perl-DBI, perl-Spreadsheet-WriteExcel, etc.

On Ubuntu the naming scheme is libmodule-name-perl.

rjh
The problem is that this installs to your system Perl. Often you don't want that, even if you think you do.
brian d foy
A: 

I, as others have would highly suggest using CPAN.pm. It is a breeze to use and can resolve any dependencies associated with the module you need automatically.

On the other hand, I would suggest that you read the perlmodinstall document over at perldoc as it gives details on other os' as well.

Regards,

Jeff

numberwhun
+1  A: 

See here: How to install perl modules using CPAN without root

I have just set this up on a server without root access and CPAN does everything automatically.

But if you really wanna install a module without CPAN and you don't have root (assuming this since you don't wanna use CPAN), you can do it as follows

perl Makefile.PL PREFIX=$HOME
make
make install

You're gonna have to hunt down dependencies yourself so it's better to use CPAN.

somebody