You won't believe this one quick Perl 6 optimization hack!

Now that I've alienated half the crowd, here's the scoop. Perl6::Parser has a fairly extensive test suite, which I run on my laptop inside an Ubuntu 14.04 VM - it's the latest version I can find that supports seamless integration, though I'm considering completely dumping the GUI and going with just a few SSH connections.

But enough of that. Baseline Rakudo Perl 6 currently runs the Perl6::Parser test suite in 0.61s usr, 0.07s sys + 80s cusr time, 90 wallclock seconds, which is rather amazing considering how extensive and invasive the test suite is. After this one simple change, that time dropped from 90 wallclock seconds to 70 wallclock seconds.

If you look at Perl6::Parser::Factory at this version, you'll see a 'role Matchable', which is public and shouldn't be.

Integrating alienfile

Last week I introduced the alienfile recipe system and we wrote a simple alienfile that provides the tool xz and the library liblzma. I also showed how to test it using App::af. Today we are going to take that alienfile and integrate it into a fully functional Alien distribution.

The main motiviation for alienfile + Alien::Build was to separate the alien detection and installer code from the perl installer code. (In fact your alienfile is fully usable without any Perl installer at all; you can use your alienfile from a Perl script or Perl module using Alien::Build directly).

For our Alien, we will be creating Alien-xz, and we will use Alien::Build::MM to provide the thin layer of functionality needed between ExtUtils::MakeMaker (EUMM) and Alien::Build. This is what our Makefile.PL should look like:

OrePAN2 Processes MetaCPAN Lookups in Chunks

The issue

In the last month of 2016, I was assigned OrePAN2 in the CPAN Pull Request Challenge. When browsing its issues on GitHub, I discovered #47:

Perl 5 Porters Mailing List Summary: March 28th - April 3rd

Hey everyone,

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

Enjoy!

DBIx :: Custom 0.39 release - Adding SQL generation feature, and simple generation of model

I released DBIx::Custom 0.39. This time it is a big update. Please do test enough when updating.

DBIx::Custom 0.39

New features

The following features are added in DBIx::Custom 0.39.

SQL generation feature

SQL generation feature was added. You can get only SQL and bind values using the query option. This is corresponding to the feature of SQL::Abstract.


  my $query = $dbi->model('book')->insert({id => 1, name => 'Perl'}, query => 1);
  
  my $sql = $query->sql;
  my $bind_values   = $query->bind_values;

You can use it in combination with other DBI modules. For example, to send an asynchronous query, you can use AnyEvent::DBI and Mojo::Pg.


  my $pg = Mojo::Pg->new('postgresql:// postgres @ / test');
  $pg->db->query($sql => @$bind_values   => sub {
    my($db, $err, $results) = @_;
    ...
  });
  Mojo::IOLoop->start unless Mojo::IOLoop->is_running;

This is the main feature of this release, which makes it possible to combine DBIx::Custom with your favorite asynchronous DBI module.

This query option is currently implemented as an experimental feature.

Reuse SQL

An introduction to CPAN distribution metadata

All CPAN releases (these days) include a metadata file which has information about the distribution. It can be used by tools like CPAN clients (when installing modules), but it's also helpful for other tool writers, and people analysing the structure of CPAN. The metadata file will be called META.yml or META.json, and recent releases often contain both.

In this blog post we'll introduce some of what's in the files and how they're used by CPAN clients.

This post is brought to you by FastMail, a gold sponsor for this year's Toolchain Summit, which is being held in Lyon, France in May. The summit is only possible with the support of companies like FastMail. We'll be doing a series of toolchain-related blog posts, to thank our sponsors.

CPAN Meta Browser

I've been looking for a better way to access the public CPAN metadata in files such as 02packages.details.txt and 06perms.txt, for checking the module index and CPAN permissions. For the latter you can always sign into https://pause.perl.org but I found that to be inconvenient. So I wrote a simple app that caches these files, converts them into a SQLite database, and then serves query results. You can find the result here: http://cpanmeta.grinnz.com/ and the source on GitHub. If there's any other metadata files that you want to be searchable let me know in a comment or GitHub issue.

berrybrew, the Perlbrew for Windows has been updated

berrybrew, the Perlbrew for Windows has been updated.

The significant new feature is the ability to automatically fetch the available Perl instances using Strawberry's new JSON releases file. This does not happen every time you use available, as I didn't want to force a user to have to be connected to the Internet while using berrybrew. Instead, I added a new berrybrew fetch command that does the work.

Things to know:

  • we now only list the most recent point version of each major release (this may change in the future)
  • we list the 64bit, 32bit and the PDL version of each major release, where available (this may also change to include other versions, such as USE_LONG_DOUBLE etc)
  • upon the first fetch, if any of the currently installed instances are lower than the most recent point release per version, we register them as custom installs. This allows them to continue to be maintained by berrybrew, and don't fall off the map as orphaned instances

Tomorrow is LWP Hack Night

Toronto.pm is hosting a LWP Hack Night tomorrow (Thursday) evening @ 7 PM. If you're interested in attending in person or virtually, I've put together a getting started guide. You don't need to be in the know in order to participate. The sheer volume of open issues means that there is plenty of low hanging fruit.

On a related note, I also announced a very helpful new module, LWP::ConsoleLogger::Everywhere, which can help you in debugging 3rd party HTTP requests made by the LWP family.

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

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

Timing

My delivery of the Action Plan was one week later than I originally expected to deliver it. The delay let me assess some of the big-picture consistency issues, which led to proposal to remove 15 methods from IO::Handle and to iron out naming and argument format for several other routines.

I still hope to complete all the code modifications prior to end of weekend of April 15, so all of these can be included in the next Rakudo Star release. And a week after, I plan to complete the grant.

Note: to minimize user impact, some of the changes may be included only in 6.d language, which will be available in 2017.04 release only if the user uses use v6.d.PREVIEW pragma.

IO Action Plan

alienfile

Alien::Base was first released in alpha form five years ago this month! The good things that Alien::Base (runtime) and Alien::Base::ModuleBuild (its installer ABMB) did when it was unleashed on the world are many, but chiefly:

  1. It suggested a standard way of providing the compiler and linker flags needed to use an already installed alien. The original manifesto was pretty flip in terms of standards or best practices.
  2. It made it dead simple to create an Alien distribution that “alienized” a package that used autoconf and pkg-config, which probably covers a majority of open source libraries that you would be likely to want to “alienize”. (For those who are unfamiliar, autoconf provides a similar functionality to ExtUtils::MakeMaker in the C world and pkg-config is used to deal with dependencies in the C world).
  3. It made it possible with some work to create an Alien distribution that wrapped around a package that used vanilla Makefile's, CMake, and in some cases crazy custom installers.

So when I was working on:

Git::Database now supports seven different Git backends

A few weeks ago, SROMANOV sent me a patch for Git::Database adding initial support for accessing the Git object database references via Git::Raw. He had already contributed a partial implementation for a Git::Wrapper backend some time ago.

This motivated me to explore that module further, and implement the methods that were missing from Sergey's patch. So I asked JACQUESG to implement a few features that I needed. He was amazingly fast at responding, and I found myself asking for more and more features. And he just kept adding them!

So, thanks to a motivated contributor and a very reactive maintainer, Git::Database 0.08 can now access data from a Git repository using any of these seven Perl Git backends:

There are in fact more Git backends on CPAN... Anyone interested in adding support for Git::Class must have understood by now that patches are welcome. :-)

Choosing a Log Level

Like all subjective decisions in technology, which log level to use is the cause of much angry debate. Worse, different logging systems use different levels: Log4j has 6 severity levels, and Syslog has 8 severity levels. While both lists of log levels come with guidance as to which level to use when, there's still enough ambiguity to cause confusion.

When choosing a log level, it's important to know how visible you want the message to be, how big of a problem it is, and what you want the user to do about it. With that in mind, this is the decision tree I follow when choosing a log level:

Perl 5 Porters Mailing List Summary: March 22nd-27th

Hey everyone,

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

Enjoy!

Using the Perl debugger with DBIx::Class

I wrote about using the Perl debugger with Moose. In that post, I showed how to use DB::Skip to make it easier to use the Perl debugger with Moose and other modules whose guts you don't want to wade through.

Today's debugger hack will make using the debugger with DBIx::Class much easier.

That Darn Single Quote

The more I think about the “single-quote as alternate package separator” thing I mentioned in my last post, the more it bothers me. The problem I ran into, trying to print "$user's crontab is missing!\n", generated an “uninitialized value” warning. It did NOT get picked up by strict mode—which was on—because packaged-qualified variables are always OK.

This strikes me as a source of hard-to-find and relatively easy-to-generate bugs. Given all the other stuff that has been deprecated out of Perl over the years, I am surprised this hasn’t been tagged for deprecation. Especially given that, according to a comment from preaction, the single-quote as a package separator was considered archaic as of Perl 5.6.

Saving your test suite history

If you saw my FOSDEM talk about Building a Universe in Perl, I show some examples of the code we use to model behaviors in our universe. I start talking about out test suite at one point and that's probably the most exciting part. You see, we've been fixing our leaderboard system in part because I can do this:

That's a truncated version of our test failure report for tests failing on master. Leaderboard tests show up twice in there.

Ever have an failing test and trying to remember if it failed before? Is it fragile code? Is it fragile tests? Has it ever failed on your master branch? What percentage of your tests fail? Well, now you can find out.

Something New Every Day

Just now, while attempting to do

print "$user's crontab is missing!\n"

I got the error “Use of uninitialized value in concatenation (.) or string…”, and after a bit of testing, I discovered that “$package'varname” is apparently an alias of “$package::varname” (in my case, Perl was trying—and failing—to print $user::s).

Did everyone else know this? This is literally the first time I have run across this in almost 20 years of Perl programming

(Of course a quick Google search turns this up in the opening paragraphs of the perlmod docs—I wonder if it’s time to read all of that stuff cover-to-cover?)

Alien::Build vs. Alien::Base::ModuleBuild

I have been working on the next generation of Alien::Base installer which is called Alien::Build. It is already quite usable, and I encourage it's use for anyone who is considering building a new Alien modules. It may also be useful to migrate existing Aliens, if they have requirements that can utilize its unique features. The main idea is to concentrate the recipe for discovery and building of a library into an alienfile which is separate from the Perl installer (usually ExtUtils::MakeMaker or Module::Build). Over the next few weeks I intend on writing a little about some of the new features of Alien::Build. In the meantime, if you are interested, Alien::Build::Manual::AlienAuthor may help you get started.

Perl 5 Porters Mailing List Summary: March 13th-21st

Hey everyone,

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

Enjoy!

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.