CPAN::R...:Dynamic(3)

๐ŸŒธ CPAN::Requirements::Dynamic ๐ŸŒธ

okay bestie, welcome to the manual page for CPAN::Requirements::Dynamic โ€” which the header line shows as CPAN::R...:Dynamic(3) because it got truncated, and honestly the ellipsis is serving main character energy ๐Ÿ’…. Anyway. This is the page for dynamic prerequisites in meta files, and it's genuinely so fun once you get it. Let's go ๐Ÿซถ


โญ VERSION โญ

version 0.003 โ€” tiny number, big vibes โœจ


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

here's the whole mood, verbatim, no cap:

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',
    },
  ],
});

look at her go ๐Ÿ˜ญ๐Ÿ’–


๐Ÿ’œ DESCRIPTION ๐Ÿ’œ

So this module implements a format for describing dynamic prerequisites of a distribution. That's it, that's the whole description. It's giving "confident and concise" and we respect it ๐Ÿ˜Œ๐Ÿ”ฅ


๐ŸŽ€ METHODS ๐ŸŽ€

๐ŸŒˆ new(%options)

The constructor! It takes two named arguments, both optional but like... highly recommended, bestie, please use them ๐Ÿฅบ

  • config โ€” an ExtUtils::Config (compatible) object for reading configuration. it's giving "power source" ๐Ÿ”‹
  • pureperl_only โ€” this should be the value of the "pureperl-only" flag. yes, exact string, keep the quotes in your head ๐ŸŽ€

๐ŸŒˆ evaluate(%options)

This one takes a hash with two named arguments: "version" and "expressions" โœจ

  • version is the version of the format, and it currently defaults to 1 (humble queen ๐Ÿ‘‘)
  • expressions is a list of hashes, and each hash can contain the following keys:

๐Ÿ’– the keys ๐Ÿ’–

  • condition โ€” the condition of the dynamic requirement. it's an array with a name as first value(s) and zero or more arguments following it. the semantics live below under "Conditions" ๐Ÿ‘€
  • prereqs โ€” a hash with modules for keys and the required version as values (e.g. { Foo => '1.234' }). love a key-value moment ๐Ÿ’ซ
  • phase โ€” the phase of the requirements. defaults to 'runtime'. other valid values include 'build' and 'test' ๐Ÿงš
  • relation โ€” the relation of the requirements. 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. so like, use them with intention, iykyk ๐Ÿ’€
ngl this is the important bit: "condition" and one of "prereqs" or "error" are mandatory. not optional, not "maybe later", mandatory periodt ๐Ÿ“Œ

๐ŸŒˆ evaluate_file($filename)

takes a filename โ€” and it can be either a YAML file or a JSON file โ€” and evaluates it. two formats, one method, slay ๐Ÿฆ‹

๐ŸŒˆ Conditions

this is the whole condition catalogue, bestie, buckle up ๐ŸŽข

  • can_run($command) โ€” returns true if a $command can be run ๐Ÿƒ
  • config_defined($variable) โ€” returns true if a specific configuration variable is defined ๐ŸŽฏ
  • has_env($variable) โ€” returns true if the environmental variable with the name in $variable is true ๐ŸŒฑ
  • has_perl($version) โ€” returns true if the perl version satisfies $version. and $version is interpreted exactly as in the CPAN::Meta spec (e.g. 1.2 equals '>= 1.2') ๐Ÿ˜ฎ no improvising!
  • 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 ๐Ÿ’จ (yes, that's really what it's called, iconic)
  • has_env โ€” this returns true if the given environmental variable is true. (yep, this one appears a second time in this list โ€” the page said it twice and I'm not about to erase her truth ๐Ÿ’…๐Ÿซถ)
  • want_xs โ€” returns true if a compiler appears to be available, and the "pureperl_only" option has not been set โš™๏ธ
  • not โ€” takes an expression and negates its value ๐Ÿ™ƒ
  • or โ€” takes a list of arrayrefs, each containing a condition expression. if at least one of the conditions is true, this will also return true ๐ŸŒŸ
  • and โ€” 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> โ€” thank you legend ๐Ÿ™Œ


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. free software fr fr ๐ŸŒˆ๐Ÿ’–


okay and the cutest little sign-off for you: this page is from perl v5.42.2, dated 2026-07-12, and it lives under the name CPAN::R...:Dynamic(3) (truncated again, she's consistent โœจ). that's the whole thing bestie, you ate this, go write some dynamic prereqs ๐ŸŽ€๐Ÿฆ‹๐Ÿ’œ

๐Ÿ“ฆ where this page comes from