Current File : //usr/local/apps/perl/man/man3/CPAN::Requirements::Dynamic.3
.\" Automatically generated by Pod::Man 4.11 (Pod::Simple 3.35)
.\"
.\" 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
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
.    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 "2025-04-06" "perl v5.30.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.002
.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 => [ 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 \*(L"Conditions\*(R"
.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 \s-1CPAN\s0 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 \s-1YAML\s0 file or a \s-1JSON\s0 file, and evaluates it.
.SS "Conditions"
.IX Subsection "Conditions"
\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_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_os(@systems)\fR
.IX Subsection "is_os(@systems)"
.PP
Returns true if the \s-1OS\s0 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 \s-1OS\s0 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
\fIwant_xs\fR
.IX Subsection "want_xs"
.PP
This returns true if a compiler appears to be available, and the \f(CW\*(C`pureperl_only\*(C'\fR option has not been set.
.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 <fawaka@gmail.com>
.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.