Parsing Nothing
In Git::Config I made the assumption that when there is nothing to parse there is nothing to do. The code looked as follows.
my $parsed = Config.parse($cfg-text); for $parsed.Hash<section>.list -> $section { # [...] }
A recent change in Rakudo broke that assumption. Parsing an empty file with a grammar that isn’t prepared to return nothing will return Failure
instead of Nil
now. As it turns out for
doesn’t like to loop over an instance of Failure
. There is an easy fix because Failure
s are undefined.
my $parsed = Config.parse($cfg-text) // [];
For your use cases it may make more sense to use // Nil
instead to get the old behaviour back. In any case I would like to ask you check your modules for assumptions reguarding .parse
or help travis to help you.
Categories: Perl6
Please note that after careful deliberation and an attempt to make this only available in v6.d.PREVIEW, it was decided to revert this commit for exactly this reason. Until we find a better way to introduce this change in API without breaking existing modules.
The thing is the for loop always ran at least once, so the code was at least slightly broken already.