Perl 5 Porters Mailing List Summary: February 13th-19th

Hey everyone,

Following is the p5p (Perl 5 Porters) mailing list summary for the past week.

Enjoy!

Else Clauses on Loops

I am curious whether anyone else would like to see else clauses applied to for/foreach and while loops,  where the code in the else clause would be executed if the loop body was completely skipped due to the conditions/boundaries. So for example:

…with a for/foreach loop:

for my $temperature ($temp_lower_bound .. $temp_upper_bound) {
  set_temperature($temperature, $soak_time);
  push @data, get_sensor_reading();
}
else {
  die "Temperature upper bound must be greater than lower bound!\n";
}

foreach my $datum (@data) {
  print "processing $datum...\n";
  process($datum);
}
else {
  warn "No data!\n";
}

…with a while loop:

open LOG_FILE, "<", $log_file
  or die "Could not open log file: $!\n";
while (<LOG_FILE>) {
  process_log_entry($_);
}
else {
  print "The log file was empty!\n";
}
close LOG_FILE;

Obviously all of these examples could be implemented by wrapping the loop in an ifthenelse that checks the condition or boundaries, or by setting a “ran once” flag in the body and checking it after, but those solutions—that I use all the time—seem unwieldy and inelegant to me.

Note this isn’t a Perl-specific concept; it could apply to almost any procedural programming language. (Does it already exist anywhere else?)

Adventure Series Part 3

See part 1 and part 2 to get caught up. In our part 2 meetup (last night), we changed things up a bit. I decided that tackling the space mission to start was going to be a bit much (too much content), so I switched us to Action Castle, the first adventure in the Parsely series. And built out a mission config file with notes from the adventure using the structures that we designed in our first meetup.

After explaining the reason for the change, the group agreed, and we continued on our merry way. As we continued to define our mission spec, we figured out an API for plugging code calls into the spec. For example, you could replace an exit like this:

exits:
  North : catacombs

With a code call like this:

exits:
  North :
    code: PluginNameGoesHere
    params:
      destination: catacombs
      foo: bar

We built some sample code for exits, actions, and turns. None of this is final or anything, just building some samples so we could work through the the thought exercise. 

Perl 5 Porters Mailing List Summary: February 7th-12th

Hey everyone,

Following is the p5p (Perl 5 Porters) mailing list summary for the past week.

Enjoy!

Of Dates, and Sigs, and Shiny Things (and cabbages and kings)

You know, I’ve been trying to analyze my working patterns lately, and I think I’ve hit on something.  Looking back over the past few years, it seems like I get obsessed with one particular project, work frantically on it and produce lots of great stuff, then I get distracted and next thing I know I’m obsessing over an entirely different project.  And then sometimes I circle back around to the first project, but it’s usually a long time later.  I’m actually starting to wonder if maybe I have some undiagnosed ADHD (not only because of the easily distracted, but also because of the hyperfocus, and SQUIRREL!).  Anyways, that appears to be the pattern of my life, so I think at this point I’m just going to have to learn to roll with it.

Our Adventures in Logging

Before we start: this is my first post at blogs.perl.org. Awesome that you're reading it despite me being a noob! :)

Three years ago, I started to change the way I think about logging in applications. Before that, to me it was just printing lines into text files, in order to later read and grep my way through them.

Then, a friend pointed me to ElasticSearch and Kibana, with its infinite ways to search through, and visualize, large amounts of textual data. Due to the nature of my $work, I was well aware of the benefits of a full text search database, however, it soon became clear that text alone was only part of the deal. The real fun in ElasticSearch begins when you add structured data into it, allowing filtering, grouping, and get all businessy with pie charts and world maps and whatnot. This would be where you'd start to gain knowledge that wouldn't be available anywhere in text-based logfiles.

Outthentic - quick way to develop users scenarios

Whether you are operations guy, devops or developer from time to time you deal with scripts development for various tasks - handy utilities, automation scripts, monitoring tools, so on.

Outthentic - is universal, language independent framework to encourage scripts development in easy and fun manner.

Here is short introduction into it - "Outthentic – quick way to develop users scenarios".

Forthcoming site downtime

The blogs.perl.org site will be unavailable for a few hours during the night of February 16th to 17th 2017. The site will stop responding at approximately 21:00 UTC on the 16th, and is expected to be back by 05:00 UTC on the 17th.

The reason for this downtime is that the data centre where the site hardware is hosted is being closed, so our hosting company is transporting all servers in that data centre to a new location.

We apologise for any inconvenience caused.

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is hosted by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.