Re: module availability problem
Hi Elizabeth, I've never studied App::Mi6 but what I read in the Readme, this program is only a part of what Mi6 does (mi6 release). Have not looked at the code. How does that compare to App::Mi6 ?? (which also uses CPAN::Uploader::Tiny, btw). On 31 Jul 2019, at 20:08, Marcel Timmerman wrote: Hi JJ Merelo, Everything is ok now, I can install newest version. Thank you very much for finding this error. In the mean time I've been busy making an uploader yesterday which saves me some handwork making the git archive and uploading it to PAUSE using its webinterface. It makes use of CPAN::Uploader::Tiny to get it there. As a side effect I will never make this mistake again because the name of the archive is the name of the directory with the version attached to it. The version is retrieved from the META6.json file. For anyone interested, the code is in the attachement of this mail. It is free to use and to make modifications but without any warranties. Regards, Marcel
Re: while(<>){...} analog?
On Wed, 31 Jul 2019 14:28:11 -0700 William Michels via perl6-users wrote: > Hi Patrick, I used both your examples as perl6 one-liners. I'm not > sure why, but I had to change .split(':') either to .split(":") or > .split(/\:/) for both example to work. Maybe it's a command-line > thing? Possibly because I'm on a Mac? See https://stackoverflow.com/questions/6697753/difference-between-single-and-double-quotes-in-bash . This behaviour affects all https://en.wikipedia.org/wiki/Bourne_shell derivatives on Mac, Linux, BSDs, and all other systems. > Also, to get the second example > to work I change the 'for lines' preamble to 'for lines()' then it's > fine (otherwise perl6 balks with an awesome error: "Function 'lines' > needs parens to avoid gobbling block"). > > Thanks again for all your help! --Best, Bill. > > # test file: six_fruits1.txt > mbook:~ homedir$ cat six_fruits1.txt > apple:banana:carrot:dragonfruit:eggplant:favabean > apricot:basil:cabbage:dill:escarole:fennel > acai:beets:celery:daikon:endive:figs > > # First example: > mbook:~ homedir$ perl6 -e 'say .split(":")[0, 2, 1, 5].join("\t") for > lines' six_fruits1.txt > apple carrot banana favabean > apricot cabbage basil fennel > acai celery beets figs > mbook:~ homedir$ perl6 -e 'say .split(/\:/)[0, 2, 1, 5].join("\t") for > lines' six_fruits1.txt > apple carrot banana favabean > apricot cabbage basil fennel > acai celery beets figs > > # Second example: note changed 'for lines' to 'for lines()' > mbook:~ homedir$ perl6 -e ' for lines() { say .split(":")[0, 2, 1, > 5].join("\t") }' six_fruits1.txt > apple carrot banana favabean > apricot cabbage basil fennel > acai celery beets figs > mbook:~ homedir$ perl6 -e ' for lines() { say .split(/\:/)[0, 2, 1, > 5].join("\t") }' six_fruits1.txt > apple carrot banana favabean > apricot cabbage basil fennel > acai celery beets figs > > > On Mon, Jul 29, 2019 at 12:56 PM Patrick R. Michaud > wrote: > > > > My guesses at Perl 6 versions of the Perl 5 example: > > > >say .split(':')[0, 2, 1, 5].join("\t") for lines; > > > > -or- > > > >for lines { say .split(':')[0, 2, 1, 5].join("\t") } > > > > Pm > > > > > > On Mon, Jul 29, 2019 at 12:49:51PM -0700, William Michels via perl6-users > > wrote: > > > Hello, Just a short backgrounder to say that this question arose this > > > past weekend at a Perl6 Meetup (Oakland, CA). Specifically we were > > > looking at how to write a Perl6 version of some introductory Perl5 > > > code in "Learning Perl", 7th Edition by Tom Phoenix, brian d foy, > > > Randal L. Schwartz: > > > > > > #Perl 5 code below: > > > while (<>) { > > > chomp; > > > print join("\t", (split /:/)[0, 2, 1, 5] ), "\n"; > > > } > > > > > > https://www.oreilly.com/library/view/learning-perl-7th/9781491954317/ch01.html > > > > > > (Thanks to Joseph Brenner for organizing the Perl6 Meetup). > > > > > > > > > > > > > > > > > > > > > On Mon, Jul 29, 2019 at 2:09 AM Elizabeth Mattijsen > > > wrote: > > > > > > > > Also, you can make this conditional: show me all the comment lines of > > > > a source file: > > > > > > > > > > > > $ perl6 -e '.say if .starts-with('#') for lines' source-file > > > > > > > > > > > > > On 29 Jul 2019, at 10:06, Richard Hainsworth > > > > > wrote: > > > > > > > > > > Also no need for all the brackets > > > > > > > > > > .say for lines; > > > > > > > > > > This is quite idiomatic Perl 6 and not golfing > > > > > > > > > > On Mon, 29 Jul 2019, 07:13 Joseph Brenner, wrote: > > > > > > > > > > > Hmmm. I would expect that to be in the Perl 5 to Perl 6 Migration > > > > > > Guides, but I do not see it there. > > > > > > > > > > Exactly, I was just looking there, and I ended up playing around with > > > > > the method form of lines, and didn't think to try the function > > > > > form of it. > > > > > > > > > > To summarize, if the goal is to write a "simple_echo" script that > > > > > can work with a file name or with lines on standard input: > > > > > > > > > >simple_echo lines.txt > > > > >cat lines.txt | simple_echo > > > > > > > > > > The perl5 version would probably be: > > > > > > > > > > #!/usr/bin/env perl > > > > > while(<>){ > > > > > print; > > > > > } > > > > > > > > > > The perl6 version would be something like: > > > > > > > > > > #!/usr/bin/env perl6 > > > > > use v6; > > > > > for lines() { > > > > > say $_; > > > > > } > > > > > > > > > > > > > > > The kind of thing I was playing with was: > > > > > > > > > > #!/usr/bin/env perl6 > > > > > use v6; > > > > > my @lines = $*ARGFILES.IO.lines; > > > > > say @lines; > > > > > > > > > > That works for lines from a file, but not from standard input, and > > > > > the error message isn't tremendously helpful: > > > > > > > > > > No such method 'lines' for invocant of type 'IO::Special' > > > > > > > > > > > > > > > > > > > > > > > > > On 7/28/19, Bruce Gray wrote: > > > > > > > > > > > > > > > > > >> On Jul 28, 2019, at 6:20 PM, Joseph Brenner > > >
[perl #124915] Roast rakudo skip/todo test:./S02-names/pseudo.t line:36 reason: 'various issues, skipping all for now'
The skip directive has been removed (at least for v6.e) with commit https://github.com/perl6/roast/commit/04c7d09341 (see also https://github.com/perl6/roast/commit/2913fbe564 for v6.c and v6.d). I'm closing this ticket as 'rejected', since there wasn't added any additional information.
[perl #127536] [BUG] UNIT:: dies horribly if used at compile time
I've added a test to S02-names/pseudo-6e.t with https://github.com/perl6/roast/commit/73d867501c I'm closing this ticket as 'resolved'.
[perl #130572] Parenthesized `for` loop is eager, even with `lazy` keyword
Back in 2017 jnthn++ already added a test for lazy for loops with https://github.com/perl6/roast/commit/3659ede149. Since the evaluations in this ticket also take the type into considerations, I've added a new test to S32-list/seq.t with https://github.com/perl6/roast/commit/207171b5ee I'm closing this ticket as 'resolved'.
Re: while(<>){...} analog?
Hi Richard, I'm trying to figure out when the parentheses in 'lines()' can be dropped, and 'lines' used instead. Any pointers? I have about nine or so working examples below, but formulating a clear rule-of-thumb is proving elusive. Any help appreciated, --Best, Bill. # test file: six_fruits1.txt mbook:~ homedir$ cat six_fruits1.txt apple:banana:carrot:dragonfruit:eggplant:favabean apricot:basil:cabbage:dill:escarole:fennel acai:beets:celery:daikon:endive:figs mbook:~ homedir$ perl6 -e '.say for lines()' six_fruits1.txt apple:banana:carrot:dragonfruit:eggplant:favabean apricot:basil:cabbage:dill:escarole:fennel acai:beets:celery:daikon:endive:figs mbook:~ homedir$ perl6 -e '.say for lines' six_fruits1.txt apple:banana:carrot:dragonfruit:eggplant:favabean apricot:basil:cabbage:dill:escarole:fennel acai:beets:celery:daikon:endive:figs mbook:~ homedir$ perl6 -e '.say for lines("a\nb\n")' six_fruits1.txt a b mbook:~ homedir$ perl6 -e '.say for lines[0]' six_fruits1.txt apple:banana:carrot:dragonfruit:eggplant:favabean mbook:~ homedir$ perl6 -e '.say for lines[0..1]' six_fruits1.txt apple:banana:carrot:dragonfruit:eggplant:favabean apricot:basil:cabbage:dill:escarole:fennel mbook:~ homedir$ perl6 -e ' for lines() { say .split(":")[0, 2, 1, 5].join("\t") };' six_fruits1.txt apple carrot banana favabean apricot cabbage basil fennel acai celery beets figs mbook:~ homedir$ perl6 -e ' for lines() {.split(":")[0, 2, 1, 5].join("\t").say};' six_fruits1.txt apple carrot banana favabean apricot cabbage basil fennel acai celery beets figs mbook:~ homedir$ perl6 -e 'for "six_fruits1.txt".IO.lines() {.split(/\:/)[0, 2, 1, 5].join("\t").say};' apple carrot banana favabean apricot cabbage basil fennel acai celery beets figs mbook:~ homedir$ perl6 -e 'for "six_fruits1.txt".IO.lines {.split(/\:/)[0, 2, 1, 5].join("\t").say};' apple carrot banana favabean apricot cabbage basil fennel acai celery beets figs On Mon, Jul 29, 2019 at 1:07 AM Richard Hainsworth wrote: > > Also no need for all the brackets > > .say for lines; > > This is quite idiomatic Perl 6 and not golfing > > On Mon, 29 Jul 2019, 07:13 Joseph Brenner, wrote: >> >> > Hmmm. I would expect that to be in the Perl 5 to Perl 6 Migration Guides, >> > but I do not see it there. >> >> Exactly, I was just looking there, and I ended up playing around with >> the method form of lines, and didn't think to try the function >> form of it. >> >> To summarize, if the goal is to write a "simple_echo" script that >> can work with a file name or with lines on standard input: >> >>simple_echo lines.txt >>cat lines.txt | simple_echo >> >> The perl5 version would probably be: >> >> #!/usr/bin/env perl >> while(<>){ >> print; >> } >> >> The perl6 version would be something like: >> >> #!/usr/bin/env perl6 >> use v6; >> for lines() { >> say $_; >> } >> >> >> The kind of thing I was playing with was: >> >> #!/usr/bin/env perl6 >> use v6; >> my @lines = $*ARGFILES.IO.lines; >> say @lines; >> >> That works for lines from a file, but not from standard input, and the >> error message isn't tremendously helpful: >> >> No such method 'lines' for invocant of type 'IO::Special' >> >> >> >> >> On 7/28/19, Bruce Gray wrote: >> > >> > >> >> On Jul 28, 2019, at 6:20 PM, Joseph Brenner wrote: >> >> >> >> I was just wondering if there's some direct analog in perl6 to the >> >> perl5 construct: >> >> >> >> while(<>){ ... } >> >> >> >> If I'm planning on passing a filename on the command-line, I can just >> >> get it out of $*ARGFILES easily enough, but what if I also wanted it >> >> to work on lines passed in via standard input? >> > >> > >> > `lines` , as a sub instead of a method, and no arguments. >> > >> > See: https://docs.perl6.org/routine/lines#(Cool)_routine_lines >> > Without any arguments, sub lines operates on $*ARGFILES, which >> > defaults to >> > $*IN in the absence of any filenames. >> > >> > For example: >> > perl6 -e 'say .join("\t") for lines().rotor(4);' path/to/file.txt >> > >> > Hmmm. I would expect that to be in the Perl 5 to Perl 6 Migration Guides, >> > but I do not see it there. >> > >> > — >> > Hope this helps, >> > Bruce Gray (Util of PerlMonks) >> > >> >
Re: while(<>){...} analog?
> On Aug 1, 2019, at 10:49 PM, William Michels via perl6-users > wrote: > > Hi Richard, I'm trying to figure out when the parentheses in 'lines()' > can be dropped, and 'lines' used instead. Any pointers? —snip— Parens will be required when `lines` is a sub call (as opposed `.lines` method call), and you have `if` or `for` to the left of `lines`, and an opening curly brace to the right of `lines`. I think this is because Perl 6's single-pass parser sees a subroutine followed by a block, and since blocks *can* be an argument to a block (as in `my @a = map { $_ + 42 }, @b;` where `map` gets the two arguments of Codeblock and Array), the `lines` sub *does* get the block as its first argument. That leaves no block for the `if` or `for`, which is clearly an error, that gets reported to you as *two* errors because the parser recognizes the probable cause: Function 'lines' needs parens to avoid gobbling block Missing block (apparently claimed by 'lines') From "Perl 6 Fundamentals: A Primer with Examples, Projects, and Case Studies" By Moritz Lenz ( and also from https://perlgeek.de/blog-en/perl-6/2017-004-book-perl6-review.html ) One case worth noting is that if you call a subroutine without arguments as the block of an if condition or a for loop (or similar constructs), you have to include the parentheses, because otherwise the block is parsed as an argument to the function. sub random-choice() { Bool.pick; } # right way: if random-choice() { say 'You were lucky.'; } # wrong way: if random-choice { say 'You were lucky.'; } If you do happen to make this mistake, the Perl 6 compiler tries very hard to detect it. In the example above, it says Function 'random-choice' needs parens to avoid gobbling block and when it tries to parse the block for the if-statement, it doesn't find one: Missing block (apparently claimed by 'random-choice') — Hope this helps, Bruce Gray (Util of PerlMonks)