Distribution::Resource Reference
Every one of the resources installed with a distribution
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 IO #
method IO()
Returns the corresponding resource as an IO::Path, which can effectively be used as such.
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.
8 no-output
class Distribution::Resource { }Not executed: the documentation states no expected output for this example.
unit class Resourceable;
method gimme(::?CLASS:U: ) {
%?RESOURCES;
}Not executed: the documentation states no expected output for this example.
{
"provides": {
"Resourceable": "lib/Resourceable.rakumod"
},
"license": "Artistic-2.0",
"description": "Testing how Distribution::Resource(s) work",
"perl": "6.*",
"auth": "zef:jj",
"version": "1.2",
"resources": [
"libraries/whatever",
"data/swim.csv"
],
"meta-version": "0",
"name": "Resourceable"
}Not executed: the documentation states no expected output for this example.
use Resourceable;
for <libraries/whatever data/swim.csv> -> $resource {
with Resourceable.gimme{$resource} {
.say;
say "-" x 10, ">";
( .repo-name, .repo, .dist-id, .key )».say;
}
}Not executed: the documentation states no expected output for this example.
# raku -Ilib bin/show-resources.raku "/home/jmerelo/progs/raku/my-raku-examples/test-resources/resources/libraries/libwhatever.so".IO ----------> (Str) file#/home/jmerelo/progs/raku/my-raku-examples/test-resources/lib /home/jmerelo/progs/raku/my-raku-examples/test-resources/lib:ver<*>:auth<>:api<*> libraries/whatever "/home/jmerelo/progs/raku/my-raku-examples/test-resources/resources/data/swim.csv".IO ----------> (Str) file#/home/jmerelo/progs/raku/my-raku-examples/test-resources/lib /home/jmerelo/progs/raku/my-raku-examples/test-resources/lib:ver<*>:auth<>:api<*> data/swim.csv
Not executed: the documentation states no expected output for this example.
"/home/jmerelo/.rakubrew/versions/moar-2020.05/install/share/perl6/site/resources/7127AA0E7F43E87DF309570E813E46A6E2C4D0B2.so".IO ----------> site (Str) 1F8F9C004D7E952B297F30420DA07B354B3F2AA7 libraries/whatever "/home/jmerelo/.rakubrew/versions/moar-2020.05/install/share/perl6/site/resources/D357F3E46256CB0DACD8975033D1CC7A17B4CF9F.csv".IO ----------> site (Str) 1F8F9C004D7E952B297F30420DA07B354B3F2AA7 data/swim.csv
Not executed: the documentation states no expected output for this example.
my @data = %?RESOURCES<data/swim.csv>.lines.split(",");Not executed: the documentation states no expected output for this example.
use NativeCall; sub foo() is native(%?RESOURCES<libraries/whatever>)
Not executed: the documentation states no expected output for this example.