logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

URI::VersionRange::Constraint - Version Constraint for Version Range Specification

Author

       •   Giuseppe Di Terlizzi <gdt@cpan.org>

Description

       A version range specifier (aka. "vers") is a URI string using the "vers" URI-scheme with this syntax:

           vers:<versioning-scheme>/<version-constraint>|<version-constraint>|...

       "vers" is the URI-scheme and is an acronym for "VErsion Range Specifier".

       The pipe "|" is used as a simple separator between "version-constraint".  Each "version-constraint" in
       this pipe-separated list contains a comparator and a version:

           <comparator:version>

       This list of "version-constraint" are signposts in the version timeline of a package that specify version
       intervals.

       A "version" satisfies a version range specifier if it is contained within any of the intervals defined by
       these "version-constraint".

       <https://github.com/package-url/purl-spec>

   OBJECT-ORIENTEDINTERFACE
       $constraint = URI::VersionRange::Constraint->new( comparator => STRING, version => STRING )
           Create new URI::VersionRange::Constraint instance.

       $constraint->comparator
           Return the comparator.

       $constraint->version
           Return the version string.

       $vers->to_string
           Stringify "vers" components.

       $vers->to_human_string
           Convert the constraint into human-readable format.

               $constraint = URI::VersionRange::Constraint->new(
                   comparator => '>=',
                   version    => '2.10'
               );

               say $constraint->to_human_string; # greater than or equal 2.10

       $vers->TO_JSON
           Helper method for JSON modules (JSON, JSON::PP, JSON::XS, Mojo::JSON, etc).

               use Mojo::JSON qw(encode_json);

               say encode_json($constraint);  # {"comparator":">","version":"2.00"}

       $vers = URI::VersionRange::Constraint->from_string($vers_string);
           Converts the given "constraint" string to URI::VersionRange::Constraint object. Croaks on error.

Name

       URI::VersionRange::Constraint - Version Constraint for Version Range Specification

Support

Bugs/FeatureRequests
       Please     report    any    bugs    or    feature    requests    through    the    issue    tracker    at
       <https://github.com/giterlizzi/perl-URI-PackageURL/issues>.  You will be notified  automatically  of  any
       progress on your issue.

   SourceCode
       This  is open source software.  The code repository is available for public review and contribution under
       the terms of the license.

       <https://github.com/giterlizzi/perl-URI-PackageURL>

           git clone https://github.com/giterlizzi/perl-URI-PackageURL.git

Synopsis

         use URI::VersionRange::Constraint;

         # OO-interface

         $constraint = URI::VersionRange::Constraint->new(
           comparator => '>',
           version    => '2.00'
         );

         say $constraint; # >2.00

         # Parse "vers" string
         $constraint = URI::VersionRange::Constraint->from_string('>2.00');

See Also