URI::V...straint(3pm)
π NAME π
URI::VersionRange::Constraint β the version constraint for a Version Range Specification. Like, it's the little guy that holds ONE comparator + version pair so the bigger vers picture can make sense. bestie it's giving tiny but mighty β¨
π 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');
okay so look at that. three lines of setup and you're already stringifying constraints. slay π
π¦ DESCRIPTION π¦
So a version range specifier (aka a "vers") is a URI string that uses the vers URI-scheme, and the syntax goes like this:
vers:<versioning-scheme>/<version-constraint>|<version-constraint>|...
vers is the URI-scheme, and ngl it's literally an acronym for "VErsion Range Specifier". iykyk π
The pipe | is just a simple separator between each version-constraint. And every version-constraint in that pipe-separated list carries a comparator and a version, like so:
<comparator:version>
This whole list of version-constraint items? They're like signposts in the version timeline of a package, marking out version intervals. no cap π
A version satisfies a version range specifier if it's contained within any of the intervals those version-constraint items define.
<https://github.com/package-url/purl-spec>
β¨ OBJECT-ORIENTED INTERFACE β¨
π new
$constraint = URI::VersionRange::Constraint->new( comparator => STRING, version => STRING )
Creates a fresh new URI::VersionRange::Constraint instance. main character energy, honestly π
π comparator
$constraint->comparator
Returns the comparator. that's it, that's the whole job π«Ά
π version
$constraint->version
Returns the version string.
π to_string
$vers->to_string
Stringifies the vers components. turning your object into a little string, iconic behaviour β¨
π to_human_string
$vers->to_human_string
Converts the constraint into a human-readable format. so you can, like, actually read it:
$constraint = URI::VersionRange::Constraint->new(
comparator => '>=',
version => '2.10'
);
say $constraint->to_human_string; # greater than or equal 2.10
see? adorable. "greater than or equal 2.10" π₯Ί
π TO_JSON
$vers->TO_JSON
Helper method for JSON modules β like JSON, JSON::PP, JSON::XS, Mojo::JSON, etc. all of them. the whole friend group π
use Mojo::JSON qw(encode_json);
say encode_json($constraint); # {"comparator":">","version":"2.00"}
π from_string
$vers = URI::VersionRange::Constraint->from_string($vers_string);
Converts the given constraint string into a URI::VersionRange::Constraint object.
β οΈ Heads up bestie: it croaks on error. no graceful little whisper, it CROAKS. so wrap it up if you're not about that π
πΈ SUPPORT πΈ
π Bugs / Feature Requests
Please report any bugs or feature requests through the issue tracker at <https://github.com/giterlizzi/perl-URI-PackageURL/issues>. You'll get notified automatically of any progress on your issue. we love updates π
π§ Source Code
This is open source software. The code repository is available for public review and contribution under the terms of the license. come hang out π«Ά
<https://github.com/giterlizzi/perl-URI-PackageURL>
git clone https://github.com/giterlizzi/perl-URI-PackageURL.git
π AUTHOR π
- Giuseppe Di Terlizzi
<gdt@cpan.org>
π LICENSE AND COPYRIGHT π
This software is copyright (c) 2022-2026 by Giuseppe Di Terlizzi.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. fr fr, do what you want with it π
okay that's the whole page bestie, and here's the lil sign-off: this was URI::V...straint(3pm), from perl v5.40.1, dated 2026-01-31, part of the User Contributed Perl Documentation π
π¦ where this page comes from
- ubuntu resolute: liburi-packageurl-perl 2.25-1 Β· Artistic-2.0
- ubuntu stonking: liburi-packageurl-perl 2.25-1 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms