From talexb at gmail.com Mon Sep 4 11:54:58 2017 From: talexb at gmail.com (Alex Beamish) Date: Mon, 4 Sep 2017 14:54:58 -0400 Subject: [tpm] Lightning talks / September 28 Message-ID: Hi All, We will be having our mostly monthly meeting this month at the offices of TEK Systems, near King and York. The topic will be Lightning Talks -- where everyone gets five minutes to give a brief, brief talk one something. Since I've organized finding the meeting space, I'm also volunteering to also organize this month's meeting. Put your thinking caps on, and E-Mail me with your ideas. Thanks! -- Alex Beamish Software Developer / https://ca.linkedin.com/in/alex-beamish-5111ba3 Baritone, Board Member, Toronto Northern Lights, 2013 Champions / www.northernlightschorus.com Certified Contest Administrator, Barbershop Harmony Society / www.barbershop.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From legrady at gmail.com Tue Sep 12 20:16:25 2017 From: legrady at gmail.com (Tom Legrady) Date: Tue, 12 Sep 2017 23:16:25 -0400 Subject: [tpm] September meeting Message-ID: I want to invite the developers from my new job to TPM lightning talks, but there is no listing for the September meeting on any of the sites that show up for a search on Toronto Perl Mongers. The sites that do show up refer to each other but are all outdated. Toronto Perl Mongers (Toronto, ON) | Meetup https://www.meetup.com/Toronto-Perl-Mongers/ Toronto Perl Mongers to.pm.org/ Meetings - Toronto Perl Mongers to.pm.org/meetings/ The recent messages refers to the location --- Tek Systems at 145 King St W --- but not to the time. It's 7 pm as usual, yes? Tom Legrady -------------- next part -------------- An HTML attachment was scrubbed... URL: From talexb at gmail.com Tue Sep 12 20:56:17 2017 From: talexb at gmail.com (Alex Beamish) Date: Tue, 12 Sep 2017 23:56:17 -0400 Subject: [tpm] September meeting In-Reply-To: References: Message-ID: Yes, the time of the meeting's 7pm. I'll ping Dave Doyle in the morning to get him to update the Meetup page that we've been using, as I've volunteered to get this meeting organized. It's Lightning Talks (our September staple) and so far we have one or perhaps two talks scheduled. My hope is that we'll get a few folks to come out, and when the talks run out we can have a spirited discussion about other technical matters, then break off for some lovely beverages. Alex On Tue, Sep 12, 2017 at 11:16 PM, Tom Legrady wrote: > > > > > > > > > > I want to invite the developers from my new job to TPM lightning talks, > but there is no listing for the September meeting on any of the sites that > show up for a search on Toronto Perl Mongers. The sites that do show up > refer to each other but are all outdated. > > Toronto Perl Mongers (Toronto, ON) | Meetup > > https://www.meetup.com/Toronto-Perl-Mongers/ > Toronto Perl Mongers > to.pm.org/ > Meetings - Toronto Perl Mongers > to.pm.org/meetings/ > > The recent messages refers to the location --- Tek Systems at 145 King St > W --- but not to the time. It's 7 pm as usual, yes? > > Tom Legrady > > > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm > > -- Alex Beamish Software Developer / https://ca.linkedin.com/in/alex-beamish-5111ba3 Baritone, Board Member, Toronto Northern Lights, 2013 Champions / www.northernlightschorus.com Certified Contest Administrator, Barbershop Harmony Society / www.barbershop.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From olaf.alders at gmail.com Wed Sep 13 07:49:51 2017 From: olaf.alders at gmail.com (Olaf Alders) Date: Wed, 13 Sep 2017 10:49:51 -0400 Subject: [tpm] September meeting In-Reply-To: References: Message-ID: > On Sep 12, 2017, at 11:56 PM, Alex Beamish wrote: > > Yes, the time of the meeting's 7pm. I'll ping Dave Doyle in the morning to get him to update the Meetup page that we've been using, as I've volunteered to get this meeting organized. > > It's Lightning Talks (our September staple) and so far we have one or perhaps two talks scheduled. My hope is that we'll get a few folks to come out, and when the talks run out we can have a spirited discussion about other technical matters, then break off for some lovely beverages. > > Alex > Hi Alex, Can you confirm the address and any special instructions needed to get into the room? We'll need that for the meetup info. Olaf From legrady at gmail.com Wed Sep 13 15:40:46 2017 From: legrady at gmail.com (Tom Legrady) Date: Wed, 13 Sep 2017 18:40:46 -0400 Subject: [tpm] September meeting In-Reply-To: References: Message-ID: <5eff99a6-71c9-e21e-2415-c942ee395b4a@gmail.com> Tek Systems 145 King Street West (please enter through the king street entrance) / Suite 600 On 2017-09-13 10:49 AM, Olaf Alders wrote: >> On Sep 12, 2017, at 11:56 PM, Alex Beamish wrote: >> >> Yes, the time of the meeting's 7pm. I'll ping Dave Doyle in the morning to get him to update the Meetup page that we've been using, as I've volunteered to get this meeting organized. >> >> It's Lightning Talks (our September staple) and so far we have one or perhaps two talks scheduled. My hope is that we'll get a few folks to come out, and when the talks run out we can have a spirited discussion about other technical matters, then break off for some lovely beverages. >> >> Alex >> > Hi Alex, > > Can you confirm the address and any special instructions needed to get into the room? We'll need that for the meetup info. > > Olaf > -------------- next part -------------- An HTML attachment was scrubbed... URL: From olaf.alders at gmail.com Wed Sep 13 17:48:03 2017 From: olaf.alders at gmail.com (Olaf Alders) Date: Wed, 13 Sep 2017 20:48:03 -0400 Subject: [tpm] September meeting In-Reply-To: <5eff99a6-71c9-e21e-2415-c942ee395b4a@gmail.com> References: <5eff99a6-71c9-e21e-2415-c942ee395b4a@gmail.com> Message-ID: <92DBA6B6-6FFF-4041-9344-B6B919C5B0C4@gmail.com> Here's the official meetup: https://www.meetup.com/Toronto-Perl-Mongers/events/243346657/ It looks like our Meetup account is up for renewal, so this would be a good opportunity to pass the hat around to keep the account going. We'll need updated billing info, so if someone other than Dave wants to take that on for this year, now would be a good time to make the transition. Olaf From legrady at gmail.com Tue Sep 26 10:53:25 2017 From: legrady at gmail.com (Tom Legrady) Date: Tue, 26 Sep 2017 13:53:25 -0400 Subject: [tpm] Dealing with nested map { grep {} } Message-ID: <6ec3ed39-ac21-aeb2-57ee-0b529c7fab13@gmail.com> As an exercise, I'm implementing a RosettaCode challenge for a game between human and computer. const my $PLAYERS => qw( human computer ); I want to automatically access the appropriate opponent for each player, which allows core game logic of while ( $no_one_won ) { for my $player ( @PLAYERS ) { $self->player( $player )->take_turn( $OPPONENT{$player} ); } } But to initialize %OPPONENT, I would need to nest a grep{} inside a map{}, which leads to two instances of $_. Now perhaps the specification of the opponent should be part of the game object or of a player object, but I'm still curious how to resolve this problem in a single stage. Now obviously you can't compare $_ with $_ ... const my %OPPONENT => map { $_ => grep { $_ ne $_ } @PLAYERS } @PLAYERS If it weren't a const object, we could do this in stages, though it's verbose and ugly: my %OPPONENT; for my $player ( @PLAYERS ) { $OPPONENT{$player} = grep { $_ ne $player } @PLAYERS } But in the case of 'const my %OPPONENT', it's an error to attempt to vivify a key after the object has become restricted. It worked fine if I replaced the inner grep{} with a subroutine call, not_me(), which would perform the grep away from the map{}. But then it occurred to me to perform a variable assignment within the map{}. Once we assign $a, we can safely redefined $_. const my %OPPONENT => map { my $a = $_; $a => grep { $_ ne $a} @PLAYERS } @PLAYERS Tom From shlomif at shlomifish.org Tue Sep 26 11:17:59 2017 From: shlomif at shlomifish.org (Shlomi Fish) Date: Tue, 26 Sep 2017 21:17:59 +0300 Subject: [tpm] Dealing with nested map { grep {} } In-Reply-To: <6ec3ed39-ac21-aeb2-57ee-0b529c7fab13@gmail.com> References: <6ec3ed39-ac21-aeb2-57ee-0b529c7fab13@gmail.com> Message-ID: <20170926211759.57333a46@telaviv1.shlomifish.org> Hi Tom, On Tue, 26 Sep 2017 13:53:25 -0400 Tom Legrady wrote: > As an exercise, I'm implementing a RosettaCode challenge for a game > between human and computer. > > const my $PLAYERS => qw( human computer ); > > I want to automatically access the appropriate opponent for each player, > which allows core game logic of > > while ( $no_one_won ) { > for my $player ( @PLAYERS ) { > $self->player( $player )->take_turn( $OPPONENT{$player} ); > } > } > > But to initialize %OPPONENT, I would need to nest a grep{} inside a > map{}, which leads to two instances of $_. Now perhaps the specification > of the opponent should be part of the game object or of a player object, > but I'm still curious how to resolve this problem in a single stage. Now > obviously you can't compare $_ with $_ ... > > const my %OPPONENT => map { $_ => grep { $_ ne $_ } @PLAYERS } @PLAYERS > > If it weren't a const object, we could do this in stages, though it's > verbose and ugly: > > my %OPPONENT; > for my $player ( @PLAYERS ) { > $OPPONENT{$player} = grep { $_ ne $player } @PLAYERS > } > > But in the case of 'const my %OPPONENT', it's an error to attempt to > vivify a key after the object has become restricted. > > It worked fine if I replaced the inner grep{} with a subroutine call, > not_me(), which would perform the grep away from the map{}. But then it > occurred to me to perform a variable assignment within the map{}. Once > we assign $a, we can safely redefined $_. > > const my %OPPONENT => map { my $a = $_; $a => grep { $_ ne $a} > @PLAYERS } @PLAYERS > this seems like a good solution but you should not use $a as the name of a lexical var. See: http://perl-begin.org/tutorials/bad-elements/#overuse_dollar_underscore http://perl-begin.org/tutorials/bad-elements/#vars-a-and-b > Tom > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm -- ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ My Aphorisms - http://www.shlomifish.org/humour.html * rindolf demands equal rights for years, minutes, hours and days to also get YAAKOV?S GREAT HUGE LOVE. ? http://www.shlomifish.org/humour/fortunes/sharp-perl.html Please reply to list if it's a mailing list post - http://shlom.in/reply . From vzshzn at gmail.com Tue Sep 26 11:45:46 2017 From: vzshzn at gmail.com (Richard) Date: Tue, 26 Sep 2017 11:45:46 -0700 Subject: [tpm] Dealing with nested map { grep {} } In-Reply-To: <20170926211759.57333a46@telaviv1.shlomifish.org> References: <6ec3ed39-ac21-aeb2-57ee-0b529c7fab13@gmail.com> <20170926211759.57333a46@telaviv1.shlomifish.org> Message-ID: Does the game always involve exactly two players? If so, it might be clearest to just define %OPPONENT without a loop or map. On Tue, Sep 26, 2017 at 11:17 AM, Shlomi Fish wrote: > Hi Tom, > > On Tue, 26 Sep 2017 13:53:25 -0400 > Tom Legrady wrote: > > > As an exercise, I'm implementing a RosettaCode challenge for a game > > between human and computer. > > > > const my $PLAYERS => qw( human computer ); > > > > I want to automatically access the appropriate opponent for each player, > > which allows core game logic of > > > > while ( $no_one_won ) { > > for my $player ( @PLAYERS ) { > > $self->player( $player )->take_turn( $OPPONENT{$player} ); > > } > > } > > > > But to initialize %OPPONENT, I would need to nest a grep{} inside a > > map{}, which leads to two instances of $_. Now perhaps the specification > > of the opponent should be part of the game object or of a player object, > > but I'm still curious how to resolve this problem in a single stage. Now > > obviously you can't compare $_ with $_ ... > > > > const my %OPPONENT => map { $_ => grep { $_ ne $_ } @PLAYERS } > @PLAYERS > > > > If it weren't a const object, we could do this in stages, though it's > > verbose and ugly: > > > > my %OPPONENT; > > for my $player ( @PLAYERS ) { > > $OPPONENT{$player} = grep { $_ ne $player } @PLAYERS > > } > > > > But in the case of 'const my %OPPONENT', it's an error to attempt to > > vivify a key after the object has become restricted. > > > > It worked fine if I replaced the inner grep{} with a subroutine call, > > not_me(), which would perform the grep away from the map{}. But then it > > occurred to me to perform a variable assignment within the map{}. Once > > we assign $a, we can safely redefined $_. > > > > const my %OPPONENT => map { my $a = $_; $a => grep { $_ ne $a} > > @PLAYERS } @PLAYERS > > > > this seems like a good solution but you should not use $a as the name of a > lexical var. See: > > http://perl-begin.org/tutorials/bad-elements/#overuse_dollar_underscore > > http://perl-begin.org/tutorials/bad-elements/#vars-a-and-b > > > > > Tom > > _______________________________________________ > > toronto-pm mailing list > > toronto-pm at pm.org > > http://mail.pm.org/mailman/listinfo/toronto-pm > > > > -- > ----------------------------------------------------------------- > Shlomi Fish http://www.shlomifish.org/ > My Aphorisms - http://www.shlomifish.org/humour.html > > * rindolf demands equal rights for years, minutes, hours and days to also > get > YAAKOV?S GREAT HUGE LOVE. > ? http://www.shlomifish.org/humour/fortunes/sharp-perl.html > > Please reply to list if it's a mailing list post - http://shlom.in/reply . > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm > -------------- next part -------------- An HTML attachment was scrubbed... URL: From legrady at gmail.com Tue Sep 26 12:34:58 2017 From: legrady at gmail.com (Tom Legrady) Date: Tue, 26 Sep 2017 15:34:58 -0400 Subject: [tpm] Dealing with nested map { grep {} } In-Reply-To: <20170926211759.57333a46@telaviv1.shlomifish.org> References: <6ec3ed39-ac21-aeb2-57ee-0b529c7fab13@gmail.com> <20170926211759.57333a46@telaviv1.shlomifish.org> Message-ID: <3865f704-fe76-8286-df6f-81634f0f24e0@gmail.com> I agree about avoiding overuse of $a & $b, but I see this interior of a map{} as an extension of the situations where there are normally used. There won't be a sort within the map and the map will never be inside a sort. Tom On 2017-09-26 02:17 PM, Shlomi Fish wrote: > Hi Tom, > > On Tue, 26 Sep 2017 13:53:25 -0400 > Tom Legrady wrote: > >> As an exercise, I'm implementing a RosettaCode challenge for a game >> between human and computer. >> >> const my $PLAYERS => qw( human computer ); >> >> I want to automatically access the appropriate opponent for each player, >> which allows core game logic of >> >> while ( $no_one_won ) { >> for my $player ( @PLAYERS ) { >> $self->player( $player )->take_turn( $OPPONENT{$player} ); >> } >> } >> >> But to initialize %OPPONENT, I would need to nest a grep{} inside a >> map{}, which leads to two instances of $_. Now perhaps the specification >> of the opponent should be part of the game object or of a player object, >> but I'm still curious how to resolve this problem in a single stage. Now >> obviously you can't compare $_ with $_ ... >> >> const my %OPPONENT => map { $_ => grep { $_ ne $_ } @PLAYERS } @PLAYERS >> >> If it weren't a const object, we could do this in stages, though it's >> verbose and ugly: >> >> my %OPPONENT; >> for my $player ( @PLAYERS ) { >> $OPPONENT{$player} = grep { $_ ne $player } @PLAYERS >> } >> >> But in the case of 'const my %OPPONENT', it's an error to attempt to >> vivify a key after the object has become restricted. >> >> It worked fine if I replaced the inner grep{} with a subroutine call, >> not_me(), which would perform the grep away from the map{}. But then it >> occurred to me to perform a variable assignment within the map{}. Once >> we assign $a, we can safely redefined $_. >> >> const my %OPPONENT => map { my $a = $_; $a => grep { $_ ne $a} >> @PLAYERS } @PLAYERS >> > this seems like a good solution but you should not use $a as the name of a > lexical var. See: > > http://perl-begin.org/tutorials/bad-elements/#overuse_dollar_underscore > > http://perl-begin.org/tutorials/bad-elements/#vars-a-and-b > > > >> Tom >> _______________________________________________ >> toronto-pm mailing list >> toronto-pm at pm.org >> http://mail.pm.org/mailman/listinfo/toronto-pm > > From uri at stemsystems.com Tue Sep 26 12:46:36 2017 From: uri at stemsystems.com (Uri Guttman) Date: Tue, 26 Sep 2017 15:46:36 -0400 Subject: [tpm] Dealing with nested map { grep {} } In-Reply-To: <3865f704-fe76-8286-df6f-81634f0f24e0@gmail.com> References: <6ec3ed39-ac21-aeb2-57ee-0b529c7fab13@gmail.com> <20170926211759.57333a46@telaviv1.shlomifish.org> <3865f704-fe76-8286-df6f-81634f0f24e0@gmail.com> Message-ID: <59CAAE9C.4050309@stemsystems.com> On 09/26/2017 03:34 PM, Tom Legrady wrote: > I agree about avoiding overuse of $a & $b, but I see this interior of > a map{} as an extension of the situations where there are normally > used. There won't be a sort within the map and the map will never be > inside a sort. > regardless of the location of a $a, it should never be used outside sort because it is special cased not to be checked for strict. the way to do nested map/grep is to assign $_ lexically to a scalar (not named $a). but depending on the data structures you can sometimes to sequential map/grep and not nested. i haven't delved into your data yet so i can't say. another trick i use sometimes is when one array can be destroyed so you can use shift on it. something like: my %hash = map { shift @keys => $_ } @vals ; that may need parens around @keys to allow clean parsing. :/ uri From vvp at cogeco.ca Tue Sep 26 14:28:43 2017 From: vvp at cogeco.ca (Viktor Pavlenko) Date: Tue, 26 Sep 2017 17:28:43 -0400 Subject: [tpm] Dealing with nested map { grep {} } In-Reply-To: <6ec3ed39-ac21-aeb2-57ee-0b529c7fab13@gmail.com> References: <6ec3ed39-ac21-aeb2-57ee-0b529c7fab13@gmail.com> Message-ID: <22986.50827.914116.775082@cogeco.ca> >>>>> "TL" == Tom Legrady writes: TL> It worked fine if I replaced the inner grep{} with a subroutine call, TL> not_me(), which would perform the grep away from the map{}. But then it TL> occurred to me to perform a variable assignment within the map{}. Once TL> we assign $a, we can safely redefined $_. TL> const my %OPPONENT => map { my $a = $_; $a => grep { $_ ne $a} TL> @PLAYERS } @PLAYERS The opponents array of a player is the players array excluding the player in question. What about going through the list once and use slices? perl -MData::Dumper -le '@ar = qw/a b c d e f g/; $hash{$ar[$_]} = [ @ar[0 .. $_ - 1, $_ + 1 .. $#ar] ] for 0 .. $#ar; print Dumper \%hash' -- Viktor From legrady at gmail.com Tue Sep 26 14:57:24 2017 From: legrady at gmail.com (Tom Legrady) Date: Tue, 26 Sep 2017 17:57:24 -0400 Subject: [tpm] Dealing with nested map { grep {} } In-Reply-To: <22986.50827.914116.775082@cogeco.ca> References: <6ec3ed39-ac21-aeb2-57ee-0b529c7fab13@gmail.com> <22986.50827.914116.775082@cogeco.ca> Message-ID: <3b6a7796-fba8-c9dc-0913-db638cbfc573@gmail.com> I was worried your solution wouldn't work with Const::Fast, but it does ... perl -MData::Dumper -MConst::Fast -le 'const my @ar => qw/a b c d e f g/; $hash{$ar[$_]} = [ @ar[0 .. $_ - 1, $_ + 1 .. $#ar] ] for 0 .. $#ar; print Dumper \%hash' $VAR1 = { 'e' => [ 'a', 'b', 'c', 'd', 'f', 'g' ], 'a' => [ 'b', 'c', 'd', 'e', 'f', 'g' ], ....... }; On 2017-09-26 05:28 PM, Viktor Pavlenko wrote: > perl -MData::Dumper -le '@ar = qw/a b c d e f g/; $hash{$ar[$_]} = [ @ar[0 .. $_ - 1, $_ + 1 .. $#ar] ] for 0 .. $#ar; print Dumper \%hash' From talexb at gmail.com Tue Sep 26 20:25:58 2017 From: talexb at gmail.com (Alex Beamish) Date: Tue, 26 Sep 2017 23:25:58 -0400 Subject: [tpm] Thursday's Lightning Talks Message-ID: Hi All, I'm the organizer for this month's meeting, and we have a collection of talks, with the following presenters: Stuart: Ansible: for all your deployment needs / and possibly .. NVidia Jetson kit for AI Tom: Adventures in Autovivification Jordan: A sous-vide presentation (possibly -- haven't heard anything further from Jordan) Yanick: Something from Ottawa (ideally, less than 3,000 slides) Seki: How to contribute to OSS (calling in from Japan -- PDF received) I did a trial Google Hangouts with Olaf tonight, so I think I know the necessary spells to cast Thursday night to get the A/V side of things going. So far, I only have slides from Seki, so please bring your presentation on a USB key -- or E-Mail it to me, please. We're going to be at TEK Systems, a recruiting firm that Olaf put me on to -- with the result that I'm just finishing up a two year contract at Manulife, doing ETL. (Thanks Olaf!!!) My contact at TEK is a very nice Australian lady called Alice (really) -- and she may be there to say hello. Once again, the address is 145 King St W, Suite 600. As this is our first visit, let's be the Perfectly Lovely User Group so that we can perhaps use this location again. I'd like to to find out when we might be meeting again -- perhaps there will also be some discussion over the next 48 hours on this mailing list about that; and perhaps we can talk about this at the end of the presentations. If we can get a non-lightning presenter ready for October, that would be excellent. See you Thursday at 7pm! -- Alex Beamish Software Developer / https://ca.linkedin.com/in/alex-beamish-5111ba3 Baritone, Board Member, Toronto Northern Lights, 2013 Champions / www.northernlightschorus.com Certified Contest Administrator, Barbershop Harmony Society / www.barbershop.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From talexb at gmail.com Thu Sep 28 16:04:12 2017 From: talexb at gmail.com (Alex Beamish) Date: Thu, 28 Sep 2017 19:04:12 -0400 Subject: [tpm] Fwd: Tonight's hangout In-Reply-To: References: Message-ID: Below is the link to tonight's hangout. ---------- Forwarded message ---------- From: "Toronto PerlMongers" Date: Sep 28, 2017 19:03 Subject: Fwd: Tonight's hangout To: Cc: Hello! ---------- Forwarded message ---------- From: Toronto PerlMongers Date: Thu, Sep 28, 2017 at 7:00 PM Subject: Tonight's hangout To: toronto-pm at pm.org Hi All, Here's the URL for tonight's meeting: https://hangouts.google.com/hangouts/_/cdu5v2i34veg5augt4hvxobkuae Broadcast will begin shortly! Alex Panicked Organizer -------------- next part -------------- An HTML attachment was scrubbed... URL: From yanick at babyl.ca Thu Sep 28 16:46:36 2017 From: yanick at babyl.ca (Yanick Champoux) Date: Thu, 28 Sep 2017 19:46:36 -0400 Subject: [tpm] Follow-up links and stuff for Neovim Message-ID: For those who are interested to know more: Neovim-RPC is on CPAN and at https://github.com/yanick/Neovim-RPC A new version that moves to IO::Async to deal with the asynchronous/network part will be out soon. I also have a few blog entries about it: http://techblog.babyl.ca/entry/neovim-plugins-part-1 http://techblog.babyl.ca/entry/neovim-plugins-part-2 Before I began to play with Neovim, I toyed with the same principle with Vim itself: see Vim::X on CPAN, and http://techblog.babyl.ca/entry/vim-x (note that this was waaaay before Vim 8 and the new asynchronous interface feature that came with it, which I will probably use if I ever revisit Vim::X) Oh yeah, and as for flipping I didn't show in details in the demo, the code you saw was code => [ split "\n", $self->flip_snippet(join "\n", @$code ) ], The part that lies behind that and that was not shown is copied below. It's nothing out of this world, just some good ol' regex brutality. If I was a more graceful soul, I'd probably use PPI, but... meh. :-) Joy! `/anick sub flip_snippet($self,$snippet) { $snippet =~ s/^\s*\n//gm; my ($indent) = $snippet =~ /^(\s*)/; $snippet =~ s/^$indent//gm; my $operators = join '|', qw/ if unless while for until /; my $block_re = qr/ ^ (?$operators) \s* (?:my \s+ (?\$\w+) \s* )? \( \s* (?[^)]+) \) \s* { (?.*) } \s* $ /xs; my $postfix_re = qr/ ^ (?[^;]+?) \s+ (?$operators) \s+ (?[^;]+?) \s* ; $ /xs; if ( $snippet =~ $block_re ) { $snippet = block_to_postifx( $snippet, %+ ); } elsif( $snippet =~ $postfix_re ) { $snippet = postfix_to_block( $snippet, %+ ); } $snippet =~ s/^\s*?\n//; $snippet =~ s/^/$indent/gm; return $snippet; } sub postfix_to_block { my( $snippet, %capture ) = @_; $snippet = $capture{inner}; chomp $capture{array}; $snippet = "$capture{operator} ( $capture{array} ) {\n $snippet\n}"; } sub block_to_postifx { my( $snippet, %capture ) = @_; # more than one statement? Don't touch it return $snippet if $capture{inner} =~ /(;)/ > 1; $snippet = $capture{inner}; $snippet =~ s/;\s*$//; $snippet =~ s/\Q$capture{variable}/\$_/g; $snippet =~ s/\$_\s*=~\s*//g; $capture{array} =~ s/\s*$//; $snippet .= " $capture{operator} $capture{array};"; return $snippet; } From talexb at gmail.com Thu Sep 28 19:44:14 2017 From: talexb at gmail.com (Alex Beamish) Date: Thu, 28 Sep 2017 22:44:14 -0400 Subject: [tpm] Lightning Talks roundup / Thanks to TEK Systems for hosting Message-ID: Greetings all, Well, I've finally hosted my first Perlmongers meeting -- about time, after coming out to these meetings for close to twenty years. We had a number of talks, each one followed by some good discussion, covering a variety of topics. There was going to be one more talk by Stuart Watt, but he was a little later than expected, and by then we'd moved on to the pub -- happy ending, he found us OK. Beer is important. In my haste to get things started on time, I went straight for the video chat with Yannick, who was calling in from Ottawa -- and I neglected to actually go through Google Hangouts and record the meeting. Ugh. So no record remains of this meeting -- I'll get this right the next time. I also didn't open the chat window, so missed that I'd not turned on screen sharing for the first talk about Autovivification by Tom Legrady. The folks watching the transmission could hear Tom, but not see his slides. Ugh. I'll get that next time too. Alice and Vaughan of TEK Systems kindly hosted us at their office, and even provided some snacks and pop, and it sounds like they are willing to host us regularly -- this is a great opportunity for our little group. And if this group is looking for an organizer, I will volunteer to take over from Dave Doyle and be speaker wrangler for, say, the next year. It sounds like Shawn S has a talk on Test-PostgreSQL he'd like to do, and Stuart has an NVidia talk that should be ready by then. I also have a short presentation on ETL that I'd like to give. If anyone else has an idea, let me know -- it would be nice to be able to say -- "Sorry, this month is full up!" Meetup.com has, I think, worked very well for this group, with at least two new group members who came to tonight's meeting, one of whom did a presentation AT HIS FIRST MEETING. I have a paid account on meetup.com, so perhaps we can talk about some account rationalization plan (we only need a single paid account). Also, Stuart gave me $10 towards the annual subscription cost, and I want to make sure that goes to the right person. So, that's my report -- please discuss. And lets plan to meet in October -- how does Thursday the 26th sound? -- Alex Beamish Software Developer / https://ca.linkedin.com/in/alex-beamish-5111ba3 Baritone, Board Member, Toronto Northern Lights, 2013 Champions / www.northernlightschorus.com Certified Contest Administrator, Barbershop Harmony Society / www.barbershop.org -------------- next part -------------- An HTML attachment was scrubbed... URL: From arocker at Vex.Net Fri Sep 29 07:06:18 2017 From: arocker at Vex.Net (arocker at Vex.Net) Date: Fri, 29 Sep 2017 10:06:18 -0400 Subject: [tpm] Lightning Talks roundup / Thanks to TEK Systems for hosting In-Reply-To: References: Message-ID: > So, that's my report -- please discuss. And lets plan to meet in October > -- > how does Thursday the 26th sound? > Sounds good to me. I'll second the thanks to TEK. All we need is a Bob to communicate with Alice. :-)* From legrady at gmail.com Fri Sep 29 08:54:14 2017 From: legrady at gmail.com (Tom Legrady) Date: Fri, 29 Sep 2017 11:54:14 -0400 Subject: [tpm] Lightning Talks roundup / Thanks to TEK Systems for hosting In-Reply-To: References: Message-ID: <26058c85-10eb-39ed-5e88-60db5ce6aca3@gmail.com> Can you provide a Charlie to attempt to intercept the message? On 2017-09-29 10:06 AM, arocker at Vex.Net wrote: >> So, that's my report -- please discuss. And lets plan to meet in October >> -- >> how does Thursday the 26th sound? >> > Sounds good to me. I'll second the thanks to TEK. All we need is a Bob to > communicate with Alice. :-)* > _______________________________________________ > toronto-pm mailing list > toronto-pm at pm.org > http://mail.pm.org/mailman/listinfo/toronto-pm >