Re: Help with %?RESOURCES variable

2023-04-20 Thread Will Coleda
On Mon, Apr 17, 2023 at 12: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 t

Re: Help with %?RESOURCES variable

2023-04-20 Thread Marcel Timmerman
On 17-04-2023 18:01, David Santiago wrote: sub MAIN(){ say %?RESOURCES{"text.txt"}.slurp(:close); } If you really want to use it from a MAIN you could make a lookup method in a module which can do the work for you (If  you are building modules anyway). use AModule; sub MAIN(){ say AModule.

Re: Help with %?RESOURCES variable

2023-04-19 Thread Polgár Márton
I mean, yes... the program runs at runtime. Anything available to the program is "available during runtime". Yes, you can look up the content at runtime - e.g from the place where it's installed. It is NOT advised to try and change the content that you can look up with %?RESOURCES - you aren't

Re: Help with %?RESOURCES variable

2023-04-19 Thread yary
https://docs.raku.org/language/variables says > %?RESOURCES is a compile-time variable available to the code of a > Distribution . > > It contains a hash that provides compile and runtime access to files > associated with the Distribution of the curren

Re: Help with %?RESOURCES variable

2023-04-19 Thread Brad Gilbert
Unless things have changed since I was last active, only modules are precompiled. `?` Twigilled variables are set at compile time. So if it had any values, they wouldn't be useful, because they would be created anew every time. On Mon, Apr 17, 2023, 11:48 AM David Santiago wrote: > > Hi Polgár >

Re: Help with %?RESOURCES variable

2023-04-17 Thread David Santiago
Hi Polgár A seg, 17-04-2023 às 18:08 +0200, Polgár Márton escreveu: > 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

Re: Help with %?RESOURCES variable

2023-04-17 Thread Polgár Márton
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 t

Re: Help with %?RESOURCES variable

2023-04-17 Thread JJ Merelo
Can you maybe list %?RESOURCES? I see nothing wrong with it, but just in case. El lun, 17 abr 2023 a las 18:01, David Santiago () escribió: > > 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: > > deman

Help with %?RESOURCES variable

2023-04-17 Thread David Santiago
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"}.slu