The problem here is defining an "environment"... The only two big use cases as for doing arch-level alternate deps (which is a mixture of looking for MSWin32 or (MSWin32||cygwin) and looking for libraries (all those XS modules).
The number of things you have to know about the target environment just gets bigger and bigger... Adam K 2009/2/2 Eric Wilhelm <scratchcomput...@gmail.com>: > # from David E. Wheeler > # on Thursday 29 January 2009 15:06: > >>As I said in my previous email, if I'm installing your code, I'm going >> to be running it, anyway. So why can't the build script be written >> in Perl? > > Well, that's the wrong argument. Sure, running arbitrary code requires > more trust than not, but structured data can be queried to the answer > for a given environment regardless of the environment in which the > query was run. > > So, arbitrary code would check $^O eq 'MSWin32', or possibly something > silly like "-d 'c:\\progra~1'" and yield the desired answer on the > target environment. But, if I wanted to determine the win32 > dependencies from Linux (for e.g. bundled packaging from a single build > machine), I would have to set $^O to get the right answer -- and that > might have undesired side-effects. > > One could require/suggest that authors use some slightly more structured > mechanism so that the query could pass a hash with e.g. a 'target_os' > key, but then you still have a black box of code to run: "my %answer = > code(%inputs)", which is a closed system. A data structure is a more > open system (like an open-face sandwhich) because you can see what the > conditionals are. > > And yes, you have to admit that at some point you haven't provided the > key/function for "whatever thing you didn't think of" and so you end up > with an eval($blackbox) situation. But, that's just one pickle in the > sandwhich so you can still identify the cheese and mustard because > everything is laid out where you can get at it. > > And, we could require that user functions be named, which means you > could absorb them into a later definition of the format. > > Note that I'm thinking beyond just building or doing CPAN meta stuff. > Things like if_os_is(...) and has_library(...) are used differently > when you start dealing with packaging for three platforms. There is > also the use-any-of-these-modules issue, where I might have > specifically chosen one to include. > > --Eric > -- > "Left to themselves, things tend to go from bad to worse." > --Murphy's Corollary > --------------------------------------------------- > http://scratchcomputing.com > --------------------------------------------------- >