views:

283

answers:

3

This is a follow-up to my previous question about developing Perl applications. Let’s say I develop an application as a CPAN module using Module::Install. Now I upload the code to the production server, say using a git push, and I would like to install the application dependencies listed in Makefile.PL. If I simply run cpan ., the thing tries to install the application like a regular Perl module, ie. starts to copy the modules and documentation to standard Perl directories all over the system.

Is this the way it’s supposed to be? Do you install the application into the standard Perl directories? I am used to having my Perl applications in one directory with separate lib. Otherwise it seems I’d have to manage a lot of other things, like installing the resources somewhere on path etc. If I just want to install the deps declared in Makefile.PL and run the application tests to make sure everything works, what should I do?

(Is this documented somewhere? I mean, is there something like best practice for deploying and updating non-trivial Perl applications? Or is everybody doing this his own way?)

+3  A: 

You could look at Module::ScanDeps to generate a list of dependent modules for installing. Or Par::Packer for packaging up the whole thing as an "app".

rjp
Thank you (+1), but that’s not quite what I want. M::S is quite orthogonal to the whole Module::Install machinery I would like to use. As for P::P, I am afraid it would make things unnecessarily complicated. Most of my applications are Catalyst web apps and it’s quite convenient for me to have a ‘live’ repository on the server when I want to fix something.
zoul
+5  A: 

I might be misunderstanding, but I think what you're looking for is

perl Makefile.PL
make installdeps
hobbs
Thank you, it looks like I do :)
zoul
+4  A: 

If you are using Module::Install, you're really using ExtUtils::Makemaker behind the scenes. You can use all of the MakeMaker features and the targets it provides. Although the documentation doesn't show every feature, there are some valuable things to be found in the generated Makefile.

However, Makemaker is old news and most everyone has asked Santa Claus for it to disappear. If you want better control, including creating your own targets and process, Module::Build is orders of magnitude easier to work with as well as cross-platform (even if that just means not using a different make, gmake, or whatever on the same OS on different boxes). If you deviate from the normal, consumer-grade installation process, you're life will be easier without Makemaker.

Some people appreciate the brevity of the Module::Install build file, but once constructed, you don't spend a lot of time messing with your build file so it's not that much of a real benefit. When the little benefit you get locks you into Makemaker, it's not a win at all.

brian d foy
I have changed to Module::Build, feels better. The 0.36 release adds an `installdeps` action that does precisely what I was asking for. Thank you.
zoul