Nemokosch Hello, how should one interpolate a quoting construct in another quoting construct? Like shell quoting inside a string. 07:05
07:50 dakkar joined
lakmatiol do you mean sth like 08:09
"the uname is $(qx{uname})"
lizmat "foo bar { do whatever code in here } baz" 08:15
Nemokosch something like that, yes 08:21
so it will require double paranthesizing, no matter what?
lizmat well, maybe, if you could use a sub like "run" you could do something like: 08:23
say "foo &run(<echo bar>, :out).out.slurp()"
or wrap that into a sub of your own and call that :-) 08:24
sub doit(@a)nsub doit(@a) { run(@a, :out).out.slurp }; say "foo &doit(<echo bar>)" 08:25
sub doit(@a) { run(@a, :out).out.slurp }; say "foo &doit(<echo bar>)" 08:26
sjn 🇳🇴 What are you specifically trying to achieve? 08:50
Nemokosch interpolating command output in a string? 08:55
this isn't an XY problem, this is really what I'm trying to achieve and I'm curious what is the idiomatic way among the many possible solutions 08:56
sjn 🇳🇴 my $output = qx<echo "foo">; 09:02
10:09 lizmat_ joined 10:10 TempIRCLogger left, TempIRCLogger joined 10:13 lizmat left 10:16 lizmat_ left, lizmat joined 11:50 TempIRCLogger left 11:51 TempIRCLogger joined
Nemokosch what if the command output should be a part of a longer string? 12:33
lizmat say "longer string $output" 12:34
Nemokosch and one without a temporary variable? ^^ 12:50
lizmat say "longer string { qx<echo foo> }" 12:51
Nemokosch so it does require some double bracketing 13:01
sjn yes, double quotes generally means interpolation allowed inside 13:11
sjn 🇳🇴 e.g. `say "Kernel is { qx[uname -s] }";` vs. `say 'Kernel is { qx[uname -s] }';` 13:17
Anton Antonov How can I find the filenames in the resources directory of module / package? The documentation here just says : 15:08
> The %?RESOURCES variable is not implemented as a plain Hash, but as an instance of the Distribution::Resources type, so do not expect to see all available resource files in a distribution by printing or by using other ways to inspect its value. Instead, use the API described above to access particular files.
dakkar Anton: may give you some examples / inspiration 15:25
(it would be nicer if github's code search understood sigils…)
Anton Antonov @dakkar Thanks, I am looking into those search results now... 15:28
15:29 dakkar left, dakkar joined, dakkar left, dakkar joined
dakkar (wow, my irc client dies when I click a link… that's new) 15:30
Anton: short version: add a file at `resources/mything.txt`, mention it in `META6.json` like `"resources":["mything.txt"]`, then read it via `$?RESOURCES<mything.txt>.slurp` or similar 15:31
the bit of documentatino you quoted just means "don't expect to see all files by calling `keys`" 15:32
also, dammit, it's `%?RESOURCES` not `$?RESOURCES`… /me is still thinking in Perl5 15:33
Anton Antonov @dakkar I am familiar with what you describe -- accessing the resource files content by explicitly specifying the individual file names. My question is: Can I find the resource file names programmatically? (Not specifying them manually.) 15:37
dakkar no, that is explicitly not a thing you can do
Anton Antonov @dakkar Ok. good to know! Thanks! 15:40
16:59 dakkar left
gfldex m:``` 18:33
class __px {}
multi postcircumfix:<{ }>(__px, @a) { "interpolation of @a[]" }
constant term:<&px> = __px;
say "&px<1 2 3>"
<@!297037173541175296> ^^^ 18:34
This is slightly evil tho. 18:35
Nemokosch what is this? 19:11
19:38 TempIRCLogger left, TempIRCLogger joined
gfldex <@!297037173541175296> This a trick to get function call semantics combined with subscripts that can be used in quotes. 20:11
m:``` 20:12
sub px(@a) { "interpolation of @a[]" }
say "&px<1 2 3>";
You can't use a sub directly. At least not without parentheses.
Nemokosch so yours works because you actually override an operator for a dummy class? 20:13
gfldex yes, and use a term that looks like a sub-reference. 20:14
I didn't expect that to work tho. Rakudo is full of surprises. :)
Nemokosch 😂 20:16
so this line 20:17
constant term:<&px> = __px;
is important here
gfldex indeed
Nemokosch does it require the "sigil"? 20:18
gfldex yes, or the quote construct would take it as verbatim
Nemokosch so there needs to be something to remind Rakudo that some interpolation is going on 20:20
makes sense
gfldex I can't find this in Roast. So it might be more then just slightly evil. I shall open a problem solving issue. 20:30