At work we use Catalyst. Catalyst apps can be (should be?) built up from multiple modules, in the sense of distribution. This allows them to be modular, which is kind of why they're called modules.
That means each project is a directory full of directories, most of which represent Perl modules, and most of which depend on each other. In order to deploy we throw this list at cpanm
(http://cpanmin.us) and let cpanm
install them all.
This works by accident, because they're all installed already, and so module X depending on module Y is normally OK because Y will be updated during the process.
For a fresh installation, cpanm
will fail to install many of them because their prerequisites are in the installation list:
$ cpanm X Y --> Working on X ... -> FAIL Installing the dependencies failed: 'Y' is not installed --> Working on Y ... -> OK Successfully installed Y
Now Y is installed, but not X.
I wrote a script to reorder them. https://gist.github.com/Altreus/26c33421c36cc1eee68c
$ installation-order X Y Y X $ cpanm $(installation-order X Y) --> Working on Y ... -> OK Successfully installed Y --> Working on X ... -> OK Successfully installed X
This will use the same information that cpanm
used in the first place to complain that Y was not installed; which is to say, if a dependency is missing, the original cpanm
invocation would not have failed anyway.
Update
It is worth noting that cpanm can install from directories; and it will always try this if the module name starts with ./
.
Therefore, X and Y above can be the result of a glob, so long as you include the ./
in the glob:
$ echo ./* ./Module1 ./Module2 $ installation-order ./* ./Module2 ./Module1
This also works with absolute paths.