Version Reference
Module version descriptor
What it is #
Routines #
Signatures are reproduced from the documentation, including their declared return types. A routine listed here is part of the type's published interface; whether Raku++ implements it is a separate question, answered by the examples below.
method new #
method new(Str:D $s)
Creates a Version from a string $s. The string is combed for the numeric, alphabetic, and wildcard components of the version object. Any characters other than alphanumerics and asterisks are assumed to be equivalent to a dot. A dot is also assumed between any adjacent numeric and alphabetic characters.
method parts #
method parts(Version:D: --> List:D)
Returns List:D.
Returns the list of parts that make up this Version object The + suffix is not considered a part of the Version object, and thus not returned by this method, as shown above in the $v2 variable.
method plus #
method plus(Version:D: --> Bool:D)
Returns Bool:D.
Returns True if comparisons against this version allow larger versions too.
method Str #
method Str(Version:D: --> Str:D)
Returns Str:D.
Returns a string representation of the invocant.
method gist #
method gist(Version:D: --> Str:D)
Returns Str:D.
Returns a string representation of the invocant, just like Str, prepended with a lowercase v.
method Capture #
method Capture()
Throws X::Cannot::Capture.
Examples, run three ways #
Every example below comes from the official documentation, together with the output that documentation asserts. Each was then executed by Rakudo and by Raku++ when this page was built. Where the three agree, one result is shown; where they do not, all three are — because which of them is wrong is exactly the information worth having.
1 no-output · 9 ok · 1 rakupp-differs
class Version { }Not executed: the documentation states no expected output for this example.
say v1.0.1 ~~ v1.*; # OUTPUT: «True» say v1.0.1 ~~ v1.*.1; # OUTPUT: «True»
True
True
Documentation, Rakudo and Raku++ all agree.
say v1.2 ~~ v1.0; # OUTPUT: «False» say v1.2 ~~ v1.0+; # OUTPUT: «True» say v0.and.anything.else ~~ v0+; # OUTPUT: «True»
False
True
True
False
True
True
False
True
False
Raku++ disagrees with both the documentation and Rakudo — a defect.
say v1.2 cmp v2.1; # OUTPUT: «Less»
Less
Documentation, Rakudo and Raku++ all agree.
say v1.0.1+ <=> v1.0.1; # OUTPUT: «More»
More
Documentation, Rakudo and Raku++ all agree.
say v1.* <=> v1.0; # OUTPUT: «Less» say v1.* <= v1.0; # OUTPUT: «True» say v1.*+ <= v1.0; # OUTPUT: «True»
Less
True
True
Documentation, Rakudo and Raku++ all agree.
say (v0.and.some.*.stuff).parts; # OUTPUT: «(0 and some * stuff)» say v0.and.some.*.stuff .parts; # OUTPUT: «(0 and some * stuff)»
(0 and some * stuff)
(0 and some * stuff)
Documentation, Rakudo and Raku++ all agree.
my $v1 = v1.0.1; my $v2 = v1.0.1+; say $v1.parts; # OUTPUT: «(1 0 1)» say $v2.parts; # OUTPUT: «(1 0 1)»
(1 0 1)
(1 0 1)
Documentation, Rakudo and Raku++ all agree.
my $v1 = v1.0.1; my $v2 = v1.0.1+; say $v1.plus; # OUTPUT: «False» say $v2.plus; # OUTPUT: «True»
False
True
Documentation, Rakudo and Raku++ all agree.
my $v1 = v1.0.1;
my $v2 = Version.new('1.0.1');
say $v1.Str; # OUTPUT: «1.0.1»
say $v2.Str; # OUTPUT: «1.0.1»1.0.1
1.0.1
Documentation, Rakudo and Raku++ all agree.
my $v1 = v1.0.1;
my $v2 = Version.new('1.0.1');
say $v1.gist; # OUTPUT: «v1.0.1»
say $v2.gist; # OUTPUT: «v1.0.1»v1.0.1
v1.0.1
Documentation, Rakudo and Raku++ all agree.