Provided by: libcpan-requirements-dynamic-perl_0.002-1_all 

NAME
CPAN::Requirements::Dynamic - Dynamic prerequisites in meta files
VERSION
version 0.002
SYNOPSIS
my $result = $dynamic->evaluate({ expressions => [ { condition => [ 'has_perl' => 'v5.20.0' ], prereqs => { Bar => "1.3" }, }, { condition => [ is_os => 'linux' ], prereqs => { Baz => "1.4" }, }, { condition => [ config_defined => 'usethreads' ], prereqs => { Quz => "1.5" }, }, { condition => [ and => [ config_defined => 'usethreads' ], [ is_os => 'openbsd' ], ], prereqs => { Euz => "1.7" }, }, { condition => [ not => is_os_type => 'Unix'], error => 'OS unsupported', }, ], });
DESCRIPTION
This module implements a format for describing dynamic prerequisites of a distribution.
METHODS
new(%options) This constructor takes two (optional but recommended) named arguments • config This is an ExtUtils::Config (compatible) object for reading configuration. • pureperl_only This should be the value of the "pureperl-only" flag. evaluate(%options) This takes a hash with two named arguments: "version" and "expressions". The former is the version of the format, it currently defaults to 1. The latter is a list of hashes that can contain the following keys: • condition The condition of the dynamic requirement. This is an array with a name as first values and zero or more arguments following it. The semantics are described below under "Conditions" • prereqs The prereqs is a hash with modules for keys and the required version as values (e.g. "{ Foo => '1.234' }"). • phase The phase of the requirements. This defaults to 'runtime'. Other valid values include 'build' and 'test'. • relation The relation of the requirements. This defaults to 'requires', but other valid values include 'recommends', 'suggests' and 'conflicts'. • error It will die with this error if set. The two messages "No support for OS" and "OS unsupported" have special meaning to CPAN Testers and are generally encouraged for situations that indicate not a failed build but an impossibility to build. "condition" and one of "prereqs" or "error" are mandatory. evaluate_file($filename) This takes a filename, that can be either a YAML file or a JSON file, and evaluates it. Conditions can_run($command) Returns true if a $command can be run. config_defined($variable) This returns true if a specific configuration variable is defined. has_env($variable) This returns true if the environmental variable with the name in $variable is true. has_perl($version) Returns true if the perl version satisfies $version. $version is interpreted exactly as in the CPAN::Meta spec (e.g. 1.2 equals '>= 1.2'). is_extended Returns true if extended testing is asked for. is_os(@systems) Returns true if the OS name equals any of @systems. is_os_type($type) Returns true if the OS type equals $type. Typical values of $type are 'Unix' or 'Windows'. is_smoker Returns true when running on a smoker. has_env This returns true if the given environmental variable is true. want_xs This returns true if a compiler appears to be available, and the "pureperl_only" option has not been set. not This takes an expression and negates its value. or This takes list of arrayrefs, each containing a condition expression. If at least one of the conditions is true this will also return true. and This takes a list of arrayrefs, each containing a condition expression. If all of the conditions are true this will also return true.
AUTHOR
Leon Timmermans <fawaka@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2023 by Leon Timmermans. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.40.1 2025-04-12 CPAN::Requirements::Dynamic(3pm)