On Feb 1, 2009, at 12:35 PM, Eric Wilhelm wrote:

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.

Why would you want to do that?

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.

So put that data into META.yml. Have Module::Build generate the file.

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.

Yes, but I sure as hell don't want to get into putting conditional statements into YAML. Good god that would be awful. I'd rather write code in Perl or Ruby or PHP than in YAML.

Best,

David

Reply via email to