.\" -*- mode: troff; coding: utf-8 -*- .\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. .ie n \{\ . ds C` "" . ds C' "" 'br\} .el\{\ . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "CPAN::Requirements::Dynamic 3" .TH CPAN::Requirements::Dynamic 3 2024-09-01 "perl v5.40.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH NAME CPAN::Requirements::Dynamic \- Dynamic prerequisites in meta files .SH VERSION .IX Header "VERSION" version 0.001 .SH SYNOPSIS .IX Header "SYNOPSIS" .Vb 10 \& my $result = $dynamic\->evaluate({ \& expressions => [ \& { \& condition => [ \*(Aqhas_perl\*(Aq => \*(Aqv5.20.0\*(Aq ], \& prereqs => { Bar => "1.3" }, \& }, \& { \& condition => [ is_os => \*(Aqlinux\*(Aq ], \& prereqs => { Baz => "1.4" }, \& }, \& { \& condition => [ config_defined => \*(Aqusethreads\*(Aq ], \& prereqs => { Quz => "1.5" }, \& }, \& { \& condition => [ has_module => \*(AqCPAN::Meta\*(Aq, \*(Aq2\*(Aq ], \& prereqs => { Wuz => "1.6" }, \& }, \& { \& condition => [ and => \& [ config_defined => \*(Aqusethreads\*(Aq ], \& [ is_os => \*(Aqopenbsd\*(Aq ], \& ], \& prereqs => { Euz => "1.7" }, \& }, \& { \& condition => [ not => is_os_type => \*(AqUnix\*(Aq], \& error => \*(AqOS unsupported\*(Aq, \& }, \& ], \& }); .Ve .SH DESCRIPTION .IX Header "DESCRIPTION" This module implements a format for describing dynamic prerequisites of a distribution. .SH METHODS .IX Header "METHODS" .SS new(%options) .IX Subsection "new(%options)" This constructor takes two (optional but recommended) named arguments .IP \(bu 4 config .Sp This is an ExtUtils::Config (compatible) object for reading configuration. .IP \(bu 4 pureperl_only .Sp This should be the value of the \f(CW\*(C`pureperl\-only\*(C'\fR flag. .SS evaluate(%options) .IX Subsection "evaluate(%options)" This takes a hash with two named arguments: \f(CW\*(C`version\*(C'\fR and \f(CW\*(C`expressions\*(C'\fR. 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: .IP \(bu 4 condition .Sp 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" .IP \(bu 4 prereqs .Sp The prereqs is a hash with modules for keys and the required version as values (e.g. \f(CW\*(C`{ Foo => \*(Aq1.234\*(Aq }\*(C'\fR). .IP \(bu 4 phase .Sp The phase of the requirements. This defaults to \f(CW\*(Aqruntime\*(Aq\fR. Other valid values include \f(CW\*(Aqbuild\*(Aq\fR and \f(CW\*(Aqtest\*(Aq\fR. .IP \(bu 4 relation .Sp The relation of the requirements. This defaults to \f(CW\*(Aqrequires\*(Aq\fR, but other valid values include \f(CW\*(Aqrecommends\*(Aq\fR, \f(CW\*(Aqsuggests\*(Aq\fR and \f(CW\*(Aqconflicts\*(Aq\fR. .IP \(bu 4 error .Sp It will die with this error if set. The two messages \f(CW"No support for OS"\fR and \f(CW"OS unsupported"\fR have special meaning to CPAN Testers and are generally encouraged for situations that indicate not a failed build but an impossibility to build. .PP \&\f(CW\*(C`condition\*(C'\fR and one of \f(CW\*(C`prereqs\*(C'\fR or \f(CW\*(C`error\*(C'\fR are mandatory. .SS evaluate_file($filename) .IX Subsection "evaluate_file($filename)" This takes a filename, that can be either a YAML file or a JSON file, and evaluates it. .SS Conditions .IX Subsection "Conditions" \fIcan_xs\fR .IX Subsection "can_xs" .PP This returns true if a compiler appears to be available. .PP \fIcan_run($command)\fR .IX Subsection "can_run($command)" .PP Returns true if a \f(CW$command\fR can be run. .PP \fIconfig_defined($variable)\fR .IX Subsection "config_defined($variable)" .PP This returns true if a specific configuration variable is defined. .PP \fIhas_env($variable)\fR .IX Subsection "has_env($variable)" .PP This returns true if the environmental variable with the name in \f(CW$variable\fR is true. .PP \fIhas_module($module, \fR\f(CI$version\fR\fI = 0)\fR .IX Subsection "has_module($module, $version = 0)" .PP Returns true if a module is installed on the system. If a \f(CW$version\fR is given, it will also check if that version is provided. \f(CW$version\fR is interpreted exactly as in the CPAN::Meta spec. .PP \fIhas_perl($version)\fR .IX Subsection "has_perl($version)" .PP Returns true if the perl version satisfies \f(CW$version\fR. \f(CW$version\fR is interpreted exactly as in the CPAN::Meta spec (e.g. \f(CW1.2\fR equals \f(CW\*(Aq>= 1.2\*(Aq\fR). .PP \fIis_extended\fR .IX Subsection "is_extended" .PP Returns true if extended testing is asked for. .PP \fIis_interactive\fR .IX Subsection "is_interactive" .PP Returns true if installed from a terminal that can answer prompts. .PP \fIis_os(@systems)\fR .IX Subsection "is_os(@systems)" .PP Returns true if the OS name equals any of \f(CW@systems\fR. .PP \fIis_os_type($type)\fR .IX Subsection "is_os_type($type)" .PP Returns true if the OS type equals \f(CW$type\fR. Typical values of \f(CW$type\fR are \f(CW\*(AqUnix\*(Aq\fR or \f(CW\*(AqWindows\*(Aq\fR. .PP \fIis_smoker\fR .IX Subsection "is_smoker" .PP Returns true when running on a smoker. .PP \fIhas_env\fR .IX Subsection "has_env" .PP This returns true if the given environmental variable is true. .PP \fIprompt_default_no\fR .IX Subsection "prompt_default_no" .PP This will ask a yes/no question to the user, defaulting to no. .PP \fIprompt_default_yes\fR .IX Subsection "prompt_default_yes" .PP This will ask a yes/no question to the user, defaulting to yes. .PP \fIwant_pureperl\fR .IX Subsection "want_pureperl" .PP This returns true if the user has indicated they want a pure-perl build. .PP \fIwant_compiled\fR .IX Subsection "want_compiled" .PP This returns true if the user has explicitly indicated they do not want a pure-perl build. .PP \fInot\fR .IX Subsection "not" .PP This takes an expression and negates its value. .PP \fIor\fR .IX Subsection "or" .PP This takes list of arrayrefs, each containing a condition expression. If at least one of the conditions is true this will also return true. .PP \fIand\fR .IX Subsection "and" .PP This takes a list of arrayrefs, each containing a condition expression. If all of the conditions are true this will also return true. .SH AUTHOR .IX Header "AUTHOR" Leon Timmermans .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2023 by Leon Timmermans. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.