Wiggins has asked for the wisdom of the Perl Monks concerning the following question:
I want to create a 'here' document/program that will determine ALL of the missing packages from a set of specified packages in 1 run. Not the first only, per run. This is a pre-test in an installation script.
Simple. I will assume that if the named package is present, the dependencies are also loaded.
--Solution--
The replies I received were just what I was hopeing for. 4 very different approaches.
For my usual projects, I try to support the largest number of OS default installations. That means that I avoid using non-Core packages. Two of the solutions provided involve non-core packages, which will not be present in a default install, or possibly in one where additional packages requested were not installed.
That leaves two remaining solutions. The first involved a loop arround an 'eval', which is pretty much what I expected. The second was a nesting of 'map' 'grep' 'map' eval require. Both solution worked (on a core only Perl install) and supplied approximately the same information.
Using the HOP principal of being wary of 'extreme cleverness' (for future maintenance reasons), I choose the classic "looped eval require" solution
Thank you all, I will be digging into the one liner for my own edification.
It is always better to have seen your target for yourself, rather than depend upon someone else's description.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: checking for all packages
by philipbailey (Curate) on May 16, 2014 at 19:50 UTC | |
|
Re: checking for all packages
by fishmonger (Chaplain) on May 16, 2014 at 20:23 UTC | |
|
Re: checking for all packages
by morgon (Priest) on May 17, 2014 at 08:51 UTC | |
|
Re: checking for all packages
by vinoth.ree (Monsignor) on May 16, 2014 at 18:30 UTC | |
by Wiggins (Hermit) on May 16, 2014 at 19:02 UTC | |
by aitap (Curate) on May 16, 2014 at 19:54 UTC | |
by vinoth.ree (Monsignor) on May 16, 2014 at 19:49 UTC | |
|
Re: checking for all packages
by Anonymous Monk on May 17, 2014 at 02:37 UTC |