🦋 Welcome to the MAIN() IRC channel of the Raku Programming Language (raku.org). Log available at irclogs.raku.org/raku/live.html . If you're a beginner, you can also check out the #raku-beginner channel!
Set by lizmat on 6 September 2022.
lizmat heh, Raku on HackerNews frontpage: news.ycombinator.com 12:07
news.ycombinator.com/item?id=36118913 12:08
lizmat clickbaits rakudoweekly.blog/2023/05/29/2023-...t-rolling/ 12:58
Tirifto While using Inline::Perl5, has anyone had to pass a variable to a function, for a value to be stored inside it? It seems like a Perl function wants me to do that, but the value I’m trying to pass is effectively read-only. 17:15
Tirifto (At least passing a scalar has Raku tell me it’s read only, and making it into a capture first doesn’t seem to do the trick…) 17:49
[Coke] add "is copy" ? 17:55
or "is rw"
Tirifto [Coke], wouldn’t I have to do that in the function/signature declaration? The function comes from Perl 5, though. 18:07
[Coke] oops, yes 18:10
how do you call this from p5? 18:14
Tirifto I am trying to use the Curses library. <metacpan.org/pod/Curses> I import it with ‘use Curses:from<Perl5>;’, then I call ‘initscr;’ to create a window, and then I want to call ‘getyx’ to get the coordinates at which the window starts. 18:23
Apparently ‘getyx’ should take three arguments: the window, a variable into which the y-coordinate will go, and a variable into which the x-coordinate will go. 18:24
I get the window by calling ‘stdscr()’ (which gets imported), and then I’m not sure how to pass the two variables next to that. 18:25
If I create them with ‘my ($y, $x)’ first, none of these approaches seem to work: 1: ‘getyx(stdscr(), $y, $x);’, 2: ‘getyx(\(stdscr(), $y, $x))’, 3: ‘my $arg = \($x, $y); getyx(stdscr(), |$arg);’, 4: ‘my $arg = \($x, $y); getyx(stdscr(), $arg);’ 18:28
Well, approach 4 doesn’t throw and error, but I also leaves the variables $x and $y empty. 18:30
Sorry if this is a bit too specific and/or convoluted. x)
[Coke] nine: any thoughts on this? 19:06
nine According to the README it should be getyx(stdscr(), \($y), \($x)) 19:34
But I fear that won't do either, as that function doesn't seem to require references. The C code seems to modify those SVs in place. 19:35
This may require a perl wrapper for functions that do such dirty tricks. 19:38
Tirifto nine, so I could do something like write a Perl function which takes a reference and then dereferences it before passing the variables to the actual function I wanted to call, right? :o 19:52
nine I'd just create a sub getyx_res { my ($scr) = @_; my ($y, $x); getyx($std, $y, $x); return ($y, $x) } 19:53
tonyo should that be scr rather than std? 20:04
nine ah, yes 20:27
lizmat the final installment of RakuAST for Early Adopters: dev.to/lizmat/shaking-the-rakuast-tree-307 20:46
tbrowder__ where/when is the raku core conf? remote access available? 21:36
elcaro Tirifto_: maybe a loaded question, but any reason stopping you from using NCurses lib (raku.land/github:azawawi/NCurses)? 22:32
kawaii I keep getting told that `No such method 'basename' for invocant of type 'Str'` - but I've double checked this about 4 times now and I'm almost certain that `.IO` is being used correctly here to convert the strings to an `IO::Path` object, no? www.irccloud.com/pastebin/GhfQRC0E/ 22:45
elcaro Yeah, it looks correct. Maybe check what `$file.^name` says, and whats in `$file.^methods`. 23:03
maybe don't shadow `$file` on that inner loop ? 23:05
You declare `my $file`, then later... `for $archive.files -> $file` 23:06
kawaii ah yeah the shadowing is not ideal, but you pointed me in the right place, `.dirname` is returning a Str :^) 23:16
thanks elcaro
elcaro oh, I didn't even see that `.basename` :) 23:17
was just looking at the first one
maybe you want `.parent` (which returns an IO) instead of `.dirname` 23:18