On Fri, May 23, 2025 at 05:44:01PM -0700, ToddAndMargo via perl6-users wrote: > Hi All, > > https://github.com/tony-o/raku-toml > > In the usage parsing example: > > Parsing TOML > use TOML; > my $config = from-toml("config.toml".IO.slurp); > # use $config like any ol' hash > > This makes perfect sense to me.
...then you realize that the from-toml() function accepts a string,
not a file, right? The string that was read from the "config.toml"
file by the .IO.slurp() method.
> But in the Generating TOML example:
>
> use TOML;
> my $config = {
> bands => ['green day',
> 'motorhead',
> 't swift',],
> favorite => 'little big',
> };
> my $toml-config = to-toml($config);
>
> I am confused. Seems to me he left something out.
> If this creates a TOML file for you, what/where
> is the file name and path? What am I missing?
...and to-toml() also produces a string. If you want to write it to
a file, you need to do that yourself later.
Hope that helps!
G'luck,
Peter
--
Peter Pentchev [email protected] [email protected] [email protected]
PGP key: https://www.ringlet.net/roam/roam.key.asc
Key fingerprint 2EE7 A7A5 17FC 124C F115 C354 651E EFB0 2527 DF13
signature.asc
Description: PGP signature
