briandfoy/LearningPerl6_Downloads

find_moth_genera.p6 doesn't quite work

tenther opened this issue · 2 comments

Hi:

I'm running Rakudo Perl 6.d on Ubuntu 18.04. I downloaded the "Learning Perl6" sample code and tried the first example. The program find_moth_genera.p6 checks for a command line argument, but then reads from standard in. So this hangs waiting for input:

$ perl6 ./find_moth_genera.p6 ../DataFiles/Butterflies_and_Moths.txt

But this works:

perl6 ./find_moth_genera.p6 ../DataFiles/Butterflies_and_Moths.txt <
./DataFiles/Butterflies_and_Moths.txt
1-7. BRITISH BUTTERFLIES....

I'd suggest a fix but I need to get further in the book.

timo commented

adding a use v6.c to the beginning of that script makes it work; v6.d changed the behavior of $*ARGFILES inside of sub MAIN; FWIW, the *@*ARGS trick is cool and i haven't seen it anywhere before.

Cool--that works. Thanks!