---
name: "CPAN::Audit::Version"
section: "3pm"
platform: "linux"
package: "libcpan-audit-perl"
version: "20250115.001-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/CPAN::Audit::Version"
---

# CPAN::Audit::Version(3pm)

the infrastructure to compare versions and version ranges

## NAME

CPAN::Audit::Version - the infrastructure to compare versions and version ranges

## SYNOPSIS

```
        use CPAN::Audit::Version;
        my $cav = CPAN::Audit::Version->new;
        $cav->in_range( $version, $range );
```

## DESCRIPTION

### Class methods

- •

  new

  Create a new object. This ignores all arguments.

### Instance methods

- •

  affected\_versions( ARRAY\_REF, RANGE )

  Given an array reference of versions, return a list of all of the versions in ARRAY\_REF that are in RANGE. This is really a filter on ARRAY\_REF using the values for which `"in_range"` returns true.

  ```
          my @matching = $cav->affected_versions( \@versions, $range );
  ```

- •

  in\_range( VERSION, RANGE )

  Returns true if VERSION is contained in RANGE, and false otherwise. VERSION is any sort of Perl, such as `1.23` or `1.2.3`. The RANGE is a comma-separated list of range specifications using the comparators `"<"`, `"<="`, `"=="`, `">"`, `">="`, or `"!="`. For example, `">=1.23,<1.45"`, `"==1.23"`, or `">1.23"`.

  ```
          my $version = 5.67;
          my $range = '>=5,<6'; # so, all the versions in 5.x
          if( $cav->in_range( $version, $range ) ) {
                  say "$version is within $range";
                  }
          else {
                  say "$version is not within $range";
          }
  ```

## LICENSE

Copyright (C) Viacheslav Tykhanovskyi.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

## AUTHOR

Viacheslav Tykhanovskyi \<viacheslav.t@gmail.com\>
