Re: Help with %?RESOURCES variable

[email protected] (Polgár Márton)
Newsgroups perl.perl6.users
Message-ID <VI1P195MB0014A04698A63EBEE7CDBDBAFE9C9@VI1P195MB0014.EURP195.PROD.OUTLOOK.COM>
I think this is the classic case of ?-twigilled, "compile-time" 
variables only being available in modules. It kind of forces you to 
always have the pattern of: heavy-lifting in a module inside lib, and 
the script just uses the module.

On 2023. 04. 17. 18:01, David Santiago wrote:
> I'm trying to use the variable %?RESOURCES without success. It doesn't
> work even when i install it locally with zef
>
> I have the following:
>
> demanuel@archlinux test> cat resources/text.txt
> This is my test file
> demanuel@archlinux test> cat bin/run-me
> sub MAIN(){
>      say %?RESOURCES{"text.txt"}.slurp(:close);
> }
> demanuel@archlinux test> cat META6.json
> {
>    "raku" : "6.d",
>    "name" : "Test",
>    "api"  : "1",
>    "auth" : "demanuel",
>    "version" : "0.0.1",
>    "description" : "my resources test",
>    "authors" : [ "demanuel" ],
>    "license" : "GPLv3",
>    "resources": [
>      "text.txt"
>    ]
> }
> demanuel@archlinux test> tree
> .
> ├── bin
> │   └── run-me
> ├── lib
> ├── META6.json
> └── resources
>      └── text.txt
>
> 4 directories, 3 files
> demanuel@archlinux test> raku -I ./lib bin/run-me
> Nil
> demanuel@archlinux test> zef install .
> ===> Testing: Test:ver<0.0.1>:auth<demanuel>:api<1>
> ===> Testing [OK] for Test:ver<0.0.1>:auth<demanuel>:api<1>
> ===> Installing: Test:ver<0.0.1>:auth<demanuel>:api<1>
>
> 1 bin/ script [run-me] installed to:
> /home/demanuel/.raku/bin
> demanuel@archlinux test> run-me
> Nil
> demanuel@archlinux test>
>
>
>
>
> Can someone point me what i'm doing wrong?
>
> Best regards,
> David Santiago
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.