Perl 6 Config::INI on Github

I now have a basic INI file parser written in Perl 6. It's clumsy and I'm quite unsure about packaging. Any and all suggestions welcome, including patches!

The basic usage is like this. Assuming we have an INI file like this (note that we trim leading and trailing whitespace on k/v's and section names):

host = http://localhost/
port = 3333

    ; these only apply to admin users
    name   = Administrator
    access = all

[ anonymous ]
    name   = Guest
    access = none

We can read it like this:

my Config::INI $config .= new; $$filename); # gets the host and port properties for $ -> $k, $v { say "$k => $v"; } # gets the name and access properties under admin my %admin = $'admin'); # dies $'no_such_section');

Yeah, it needs a lot of work, but Perl 6 still twists my mind from time to time.

If you want to run the tests, make sure your Rakudo is up to date and:

PERL6LIB=lib/ prove --exec perl6 t/

This assumes that you have perl6 installed.


This just popped into my head so forgive me. Are Perl6 and Perl5 modules going to reside in the same CPAN?

I am guessing there will be some kind of META tag to determine that a module is usable for which generation. Otherwise you will have a tidy mess to deal with.

Are Perl6 and Perl5 modules going to reside in the same CPAN?

It has not been defined yet, and really, definitions don't count if people don't do it that way.

Last I knew, there is not a toolchain that installs modules anyway, so where the toolchain gets the modules is moot.

The link is broken. It goes Config-Tiny, but apparently you called it Config-INI.

Leave a comment

About Ovid

user-pic Have Perl; Will Travel. Freelance Perl/Testing/Agile consultant. Photo by Warning: that site is not safe for work. The photographer is a good friend of mine, though, and it's appropriate to credit his work.