This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html
Set by lizmat on 8 June 2022.
06:34 stanrifkin joined 08:51 elcaro left 09:16 lizmat left, lizmat_ joined 09:17 lizmat_ left, lizmat joined 10:15 stanrifkin left
Welemtam Hi ! I followed this (stackoverflow.com/questions/663571...raku-cli), especially Brad Gilbert's answer, to install a local module with zef, on Windows. (the main goal being to be able to call "myProgram" directly in the shell instead of "raku path\to\myProgram.raku") So I have - a file bin\mymodule in which I just do "use mymodulem" ; - a file 17:00
bin\mymodulem.rakumod containing my program, in sub MAIN() - META6.json referencing "mymodulem.rakumod", and a little test in t\ just to validate the import then : zef install . It works, generates a bat "mymodule" in C:\Users\me\.raku\bin , which I can call, that bat is running "mymodule" in the same folder, which has been generated at install: #!/usr/bin/env rakudo sub MAIN(*@, *%) {
CompUnit::RepositoryRegistry.run-script("mymodule"); } But it does nothing and my program is never called (it enters in MAIN, confirmed it with printfs, but then nothing happens when calling CompUnit) Do I miss something? Thanks!
librasteve @Welemtam welcome! your question is a bit of a poser since nobody here really uses Windows - I can tell you on macOS (or linux) that zef install My::Module will add a raku script as a command to your path, so it seems to me (if windoze does the same) that you should be able to just run it - otherwsie 17:59
then you may have to tell your users how to modify their path... 18:00
[i am saying this to reflect your main goal :: the main goal being to be able to call "myProgram" directly in the shell instead of "raku path\to\myProgram.raku"
> zef install App::Crag ===> Searching for: App::Crag ===> Staging App::Crag:ver<0.0.24>:auth<zef:librasteve>:api<1> ===> Staging [OK] for App::Crag:ver<0.0.24>:auth<zef:librasteve>:api<1> ===> Testing: App::Crag:ver<0.0.24>:auth<zef:librasteve>:api<1> ===> Testing [OK] for App::Crag:ver<0.0.24>:auth<zef:librasteve>:api<1> ===> Installing: App::Crag:ver<0.0.24>:auth<zef:librasteve>:api<1> 1 bin/ script 18:03
[crag] installed to: /Users/xxx/.rakubrew/versions/moar-2025.02/share/perl6/site/bin > crag 'i ** 2' #-1+0i
you may want to try WSL if this is mainly development / learning ... if you want to develop an app to share with windows users, then this is not a beginner topic really (since raku does not have binary distribution chops) 18:06
18:12 habere-et-disper joined
Welemtam Thanks for your answer ! I will try WSL or, if I have time, I will reinstall my debian dual boot 🙂 I agree it is sometime simpler on linux 🙂 I just wanted to install "mymodule" for myself, so, no users involved. Indeed that "command script" has been generated in my install path (c:/users/ ... .raku/bin) and it calls : (that's what I copied above also) 18:18
CompUnit::RepositoryRegistry.run-script("mymodule"); # generated stuff It is in my PATH, since that script runs (I added a print "hello" above that line, it prints hello) , but the CompUnit thing returns silently without invoking "mymodule". Maybe it is some windows specific problem ..
librasteve ok, I see, I suppose I dont get why you dont just put use mymodule; in your script 18:42
did you check the MeTA6.json names MyModule (sorry convention is that module names are MyModule.rakumod) in the provides? 18:43
19:20 habere-et-disper left
Welemtam it's not me, zef generates that CompUnit::RepositoryRegistry.run-script, probably some kind of glu to handle precompilation (?) But I think I know where I messed up, this is the non-working sample : github.com/MatthieuHAMEL/My-Raku-S...n/mymodule I followed obediently the "recipe" from Brad Gilbert 19:33
stackoverflow.com/questions/663571...a-raku-cli With the code in a rakumod to benefit from the compilation, and the file without extension is more for generating a nicely named command script. But the "use MyModuleM" just doesn't do anything. Now it works when I add "is export" to the sub MAIN in the rakumod.
thanks a lot for you help
librasteve @Welemtam kudos ... sorry I was not very helpful 20:54
21:17 habere-et-disper joined 22:38 habere-et-disper left 23:49 stanrifkin joined