Alan Kay’s critique of the TPF grants program

Alan Kay:

A few principles:

Perl 6 IO TPF Grant: Monthly Report (April, 2017)

This document is the April, 2017 progress report for TPF Standardization, Test Coverage, and Documentation of Perl 6 I/O Routines grant

Timing

As proposed to and approved by the Grant Manager, I've extended the due date for this grant by 1 extra month, in exchange for doing some extra optimization work on IO routines at no extra cost. The new completion date is May 22nd; right after the next Rakudo compiler release.

Communications

I've created and published three notices as part of this grant, informing the users on what is changing and how to best upgrade their code, where needed:

IO Action Plan Progress

Most of the IO Action Plan has been implemented and got shipped in Rakudo's 2017.04.2 release. The remaining items are:

Soft call operator: ~> (thoughts)

Perl 5 Porters Mailing List Summary: April 11th-16th

Hey everyone,

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

Enjoy!

Alternatives to rand()

I recently added some functionality for random number generation to my modules, which led me on a digression about rand(). This is a short look at some modules for getting random floating point values. A later one will look at random ints and bytes.

Modules for rand()
Module
Algorithm
Stat
Quality
Interval Bits in
output
Auto
Seed
Predictable Speed
CORE::rand
drand48
Bad [0,1) 48 OK Yes 29000 k/s
Math::Random::MTwist
MT XS
OK [0,1) 53 OK Yes 14000 k/s
ntheory
ChaCha20 XS
Good [0,1) 53-113 Full No 12000 k/s
Math::Prime::Util::GMP
ISAAC XS
Good [0,1) 53-64 Good No 14000 k/s
Crypt::PRNG
Fortuna XS
Good [0,1) 53 Good No 700 k/s
Math::Random::MT::Auto
MT XS
OK [0,1) 52 Full Yes 5000 k/s
Math::Random::MT
MT XS
OK [0,1) 32 rand() Yes 2200 k/s
Math::Random::Secure
Math::Random::ISAAC
Good [0,1) 32 Full No 460 k/s
Math::Random::ISAAC
ISAAC XS or PP
Good [0,1] 32 None No 5700 k/s
480 k/s
Math::Random::Xorshift
Xorshift XS
OK [0,1] 32 Time Yes 16000 k/s

The Perl Toolchain Summit Project List

The Perl Toolchain Summit (PTS) is the annual event where we assemble the people who are actively working on the Perl toolchain, and give them 4 days to work together. In this blog post, we'll look at how we decide what everyone will work on, and give you a chance to make suggestions.

This blog post is brought to you by Perl Jobs by Perl Careers, which as well as helping Perl programmers find jobs, supports a number of community events, including the QA Hackathon last year.

Autoload::AUTOCAN - Autoloading the easy way

Autoload can be a very powerful tool in Perl, though often you should first consider if there's a better way; Autoload is not necessarily the best solution for cases where you just need to generate many methods by name, and definitely is not the best solution for "wrapping" static methods. But if your use-case does necessitate methods created on the fly, I have released Autoload::AUTOCAN to make this easier to get right.

Trials and troubles with changing @INC

With the upcoming 5.26 release series of Perl, there's a breaking change that's part of the release. The current directory, '.', is being removed from @INC. It's a good thing, it deals with a bunch of potential security problems and has been discussed more thoroughly elsewhere http://www.nntp.perl.org/group/perl.perl5.porters/2017/03/msg243763.html and http://www.nntp.perl.org/group/perl.perl5.porters/2017/03/msg243722.html

This means that a number of common patterns in many perl scripts, particularly tests, no longer work the way that they did in the past.

use inc::Module::Install;  # To get the bundled copy of Module::Install with a CPAN dist

# Usually used to setup some common test environment
#  or common functions for the tests
require 't/common_thing.pl';
use t::common;

# I'm not sure what the actual common use of this is, but it's also impacted.
do 'config.pl';

Virtual Spring Cleaning Interlude: A herd of yaks, all waiting to be shaved

In my long-term quest to host all of my data on my systems, one of the major points is to replace the note-taking app Google Keep with something that allows me to take my notes back to me. I've looked at various open-source apps for taking and synchronizing notes, but they either feel like overdesigned monsters that don't fit my workflow (Laverna) or don't have good synchronization from mobile phone to the server.

Sydney Perl Mongers: April Meeting

You are invited to join us for this months Sydney PM meeting. We are hosted for the fist time by BarNet and we are glad and grateful for their invitation.

Everyone with an interest is welcome regardless of your experience with Perl and although we appreciate people RSVP'ing on Meetup, there is no need. Feel free to show up (and bring a friend) if you can make it.

There will be two speakers.

Lloyd will be speaking on his config management system, written in perl6

Brendan will be speaking about HashiCorp's Vault software, and how you can make use of it in your systems

When? Tuesday, April 18, 2017 6:00 PM

Where? BarNet ( Technology Dispute Centre ) 7/155 King Street, Sydney (St James Station is probably closest)


Find us on Meetup.com or Facebook

MVC::Neaf - Not Even A (Web Application) Framework

Hello everyone, today I'd like to present Neaf [ni:f], a web tool that tries hard to stay out of the way. Initially it was started for my own education. However, the result may be worth looking at even for users of serious stuff like Mojo, Dancer, and Kelp.

The main usage scenarios are perhaps sharing an existing module or script via the network, as well as supplementary tools and admin interfaces.

Golang's 'defer' in Perl

My day job involves programming in Go. One feature I like about Go is "defer". Any function that's deferred gets ran at the end of the functions scope. As a very simple example, the program below prints

hello
world

instead of the other way around, because "world" is deferred until the main() function exits.

package main
import "fmt"

func main() {
    defer fmt.Println("world")
    fmt.Println("hello")
}

I find this cleaner: you can write clean-up closer to where you allocate/acquire resources, instead of remembering to do it at the end of your function. In order to do this in perl, I created a defer() function which, given a subref, returns a wrapper subref blessed into a dummy package. Then, I give that dummy package a destructor (DESTROY) which calls itself. The result is that the subroutine given will be run when the variable it is assigned to goes out of scope:

A very simple LRU cache with Tie::IxHash

Recently, I needed to add a simple cache to my application. In particular, I was looking for a way to memo-ize a function, and age out old entries as necessary. There's great cache modules on CPAN that do this, but I needed to accomplish it with only standard modules.

In order to create a very dumb Least-Recently-Used cache, you need a list and a hash. The hash obviously stores mapping from keys to values, and the list keeps the order of items in the most recently-used order. When an existing item is modified or retrieved, its key moves to the end of the list. When an insertion is made that would overflow the size limit of the cache, entries from the front of the list are removed. Note that the implementation below would only work for string keys (and things that are convertible to strings, like intergers, since perl hash keys are stringified), but it shouldn't be too hard to modify to handle arbitrary objects.

How fast can you try?

I just saw the release of Aristotle's Try::Tiny::Tiny to CPAN, which aims to speed up Try::Tiny. That led me to wonder how fast the various Try* modules were. I cannibalized the benchmark code from Try::Catch, and off I went.

Timeouts for Parallel::ForkManager

At tonight's Chicago Perl Mongers Office Hours, Ray came up with an interesting problem. While testing all of CPAN for CPAN Testers, how do you detect when a test is hanging and kill it before it takes down the entire machine? How do you simply kill a test that is taking too long? And how do you do it without having a wholly separate watchdog program?

Ray's using Parallel::ForkManager to execute testing jobs in parallel across multiple Perl installs. There are a few ways we could implement timeouts, including IPC::Run's timeout function, or the alarm Perl built-in, but these must all be implemented in the child process. It'd be nicer if we could use the parent process to watch its own children.

An interesting memory hog

So last day I with a colleague got to trace an interesting memory leak ( which was rather a memory waste than a leak ). It was using tens of gigabytes of RAM, whereas I wouldn't expect it to use more than 3-4GB.

Call it a witchcraft if you like, but we identified line to blame within first minutes we started looking at the problem. Unfortunately, we were not able to convince each other that it is the issue and as the problem was only visible in a long running soak test we were not able to justify running it.

Perl's garbage collection works by reference counting and only frees circular references at exit. As we were dealing with a long running daemon - we started by trying to locate circular references. Inspecting code gave nothing away. So we decided to utilise wonderful Paul Evans' Devel::MAT module. Unfortunately we were not able to locate any circular references.

Virtual Spring Cleaning (part 1 of XX / 2017) - in which I hear CPANs call

Virtual Spring Cleaning (part 1 of XX / 2017) - in which I look who's calling

I really like the products by AVM, especially their Fritz!Box line of VoIP+DSL modems. For a long time, I've wanted to synchronize my CardDAV contacts from my server to my Fritz!Box, so that the reverse number lookup works on my landline as well as my mobile phone.

Perl 5 Porters Mailing List Summary: April 4th-10th

Hey everyone,

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

Enjoy!

Dependency phases in CPAN distribution metadata

In the previous article in this series we gave a general introduction to the distribution metadata which is included in releases as files META.json and/or META.yml. In this article I'll drill into more detail at one critical component of a distribution's metadata: dependencies, also known as prerequisites (usually shortened to "prereqs"). This is how you specify other CPAN modules that your distribution depends on.

This post is brought to you by Booking.com, a platinum sponsor for the Perl Toolchain Summit. Booking.com is one of the largest Perl shops in the world, and so depends heavily on the toolchain. Thank you to Booking.com for supporting the summit.

Dist::Zilla @Starter - Revision 2

I recently released revision 2 of the [@Starter] plugin bundle for Dist::Zilla. This revision brings small improvements to the default behavior, as well as the option to set a different installer plugin. In order to use the new revision, you must set the option "revision = 2" when using the bundle.

Revision 2 uses [Pod2Readme] instead of [ReadmeAnyFromPod] to generate the text README file. [ReadmeAnyFromPod] is a great and flexible plugin, but [Pod2Readme] is much simpler for the specific purpose of generating a text README. For any additional README files in other formats, I still recommend using [ReadmeAnyFromPod].

This revision also sets the option "inherit_version" in [MetaProvides::Package] to 0 by default. This makes no difference if your distribution contains uniform module versions, or for modules which have no version (they are still marked as having the distribution version unless you set "inherit_missing" to 0 as well), but if you have modules with different versions hardcoded, this will reflect that in the "provides" metadata.

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.