Still Suck in the API Moose

Its even more API Day here in the Moose-Pen

In yesterday's post I found a back door to fields in a DB that are not part of a Database::Accessor instance. I was able with this 'gather/group by'

da->add_gather({elements => [{name => 'user_id',
                               view => 'people'},
                               {name => 'salary',
                               view => 'people'}],
                 view_elements=>[{name => 'user_id'',
                                  view => 'people'},
                                 {name => 'salary',
                                  view => 'people'},]
                });

Introducing: Perl 6 Marketing Assets Web App

Read this article on Rakudo.Party

As some of you already may have known from occasional tweets and mentions in the Weekly, we have a perl6/marketing repo that contains some flyers and brochures for Perl 6.

With one of the Perl 6 coredevs making a living as a Multi-Media Designer, the repo has seen a steady stream of new pieces designed, when inspiration strikes, or when someone makes a request. There are now several pieces available, but GitHub isn't the greatest interface for this sort of stuff.

Introducing marketing.perl6.org

To make it easier to see what we have available, we made a front-end for our marketing repo, that lets you browse all of the assets. It's hosted at marketing.perl6.org

The Assets

Exploring Type::Tiny Part 2: Using Type::Tiny with Moose

Type::Tiny is probably best known as a way of having Moose-like type constraints in Moo, but it can be used for so much more. This is the second in a series of posts showing other things you can use Type::Tiny for. You can refer back to part 1.

Type::Tiny is often used in Moo classes and roles as a drop-in replacement for Moose's built-in type system. But the original reason I wrote it was as a response to the growing number of MooseX::Types and MouseX::Types modules on CPAN. I thought "wouldn't it be good if you could write a type library once, and use it for Moose, Mouse, and maybe even Moo?" In the very early version, you needed to import types like this:

   use Type::Standard -moose, qw(Int);
   use Type::Standard -mouse, qw(Int);
   use Type::Standard -moo,   qw(Int);

Comparative Analysis - Report (July 2018)

July has been little stressful for me. Why? For the first time ever, I struggled to find issues to help with PR. Partly because the "Kwalitee" link was broken for first 2 weeks. Even when it became active, there was hardly anything for me to work on. Is it because CPAN authors are becoming smarter these days? At one point, I thought I am going miss the target of average 1 PR a day. Luckily the second half of the month was really productive. Apart from PR, there is another thing that kept me on my toes, which is daily uploads to CPAN. Having done this for over 1000 days without break in the past, I am finding it hard to carry on currently at 345 days. However I have enough things to carry on for at least another 2 weeks. I would be happy if I could complete 1 year without break.

Lets do comparative analysis on the listed points:

  • Pull Request
  • Git Commits
  • Pull Request Challenge
  • Perl Blog
  • PerlWeekly Newsletter
  • Adopt CPAN Module

More Bugs on Moose

It try it out day here in the Moose-Pen

With that new API in hand lets give a practical test in my 'xt' dir another go. Starting with this test;

Talk Slides and Recording: "Intro Into Perl 6 Regexes and Grammars"

Read this article on Rakudo.Party

Last week I gave a "Intro Into Perl 6 Regexes and Grammars" talk at the Toronto Perl Mongers, whom I thank for letting me speak.

For google hangout that is usually set up, we got to use the fancy equipment provided by the company that was letting us use their space. Unfortunately, it's currently unclear if the hangout was recorded and if there would be a video of the talk.

So, I figured I'd make a screencast of the talk. You won't get some of the discussions that occurred during the meeting, but the content of the talk itself is pretty much identical.

You can view the slides at https://tpm-regex.perl6.party/ and the screencast of the talk is on YouTube:

3 Weeks left to sign up for the Perl 6 Tutorial course at TPC in Glasgow

Be ready for all the new Perl 6 content at the Glasgow Perl Conference, join me at the day-long Perl 6 Tutorial session on Monday the 13th, get trained before the talks start!

The Future of Perl 5

No, I'm not speculating about where Perl 5 is going, but I was imagining a few minor (hah!) features that would make life much simpler.

In fact, I was imagining a minimalist OO system with optional typing.

The following is a simple LRU cache in Moose:

Maybe more Moose Bugs?

Still playing with the API here in the Moos-Pen today.

Now that I have that new API for 'Gather/Group By' I will have to update how Driver::DBI works. Starting with the new test in the 50_group_by.t test case.

perldoc.pl now powered by Elasticsearch

perldoc.pl, the alternative perldoc browser, originally leveraged PostgreSQL full text searching. But as I encountered new issues as well as ones I encountered before, I started working to make the search backend swappable.

There are now three search backends available: PostgreSQL, Elasticsearch, and SQLite using the FTS5 extension. While SQLite is of course the simplest to deploy as it requires no setup, I decided against using it for the main perldoc.pl instance as it does not support skipping stopwords, but the backend is now provided so basic search features can be added to a deployment without setting up a database. Additionally, the application can be deployed without any search backend configured, which will just remove the search box and allow viewing of all pages normally.

Iridium Flare End-Of-Life II

Late last year, I blogged about my plans for handling the Iridium flare functionality in the Astro-satpass distribution given that these satellites are being taken out of service in favor of a new design that does not flare.

For some time now, most of the updates to Astro-satpass have been to maintain the canned Iridium status table. This seemed wrong to me, so I have pulled Astro::Coord::ECI::TLE::Iridium out into its own distribution. This is currently available on CPAN. The first distribution of Astro-satpass without this module will be version 0.100, which should be out in a few days.

For people who use one of the CPAN clients, this should be a non-event. I know of no downstream packagers except for ActiveState and MacPorts. Last I looked, ActiveState was just automatically picking up all of CPAN (or not, as the case may be), though if there was no PPM package a CPAN client would work. I have filed a bug with MacPorts describing what is going on. We will see what happens.

opensource.com: Confessions of a recovering Perl hacker

"I always insisted on commenting my Perl. I never got to the very end of the Camel Book. Not in one reading, anyway. I never experimented with the darker side-effects; three or four separate operations per line was always enough for me. Over time, as my responsibilities moved more to programming, I cut back on the sysadmin tasks. Of course, that didn't stop the Perl use completely--it's amazing how often you can find an excuse to automate a task and how often Perl is the answer. But it reduced my Perl to manageable levels, levels that didn't affect my day-to-day functioning."

Read on: https://opensource.com/article/18/7/confessions-recovering-perl-hacker

Moose Finds More Bugs

Back to the API day here in the Moose-Pen

Well I was just going to do a simple test post-ette today but on my first run I ran into this in the '30_view.t' test case for Database::Accessor;

Can't call method "view_count" on an undefined value at D:\GitHub\database-
accessor\lib/Database/Accessor.pm line 762.
# Looks like your test exited with 255 before it could output anything.
Hmm so I have a few loose ends from yesterday's post. The code in question is this line

 @elements = @{$self->gather->view_elements()}
          if ($self->gather->view_count());
In this case the test starts with this $in_hash;

Release SPVM 0.0359

Release SPVM 0.0359

SPVM - Fast array and numeric operation, and provide easy way to C/C++ Binding

0.0359 2018-07-16
  - SPVM::CORE become done native compile
  - add join function
  - fix const assignment bug
  - support list syntax
      my $nums = [(1, 2), (3, 4), (5, 6)];
  - object have body field at offset 0. This will fix alignment bugs.

New githook-perltidy feature: README from POD

It has been six years since I last mentioned anything about githook-perltidy, a tool for the automatic tidying of Perl and POD files during a Git commit. I rely on it every day, and I still make minor improvements to it, so I thought it worth a quick shout out to others who haven't heard about it or upgraded for a while.

Some CPAN distribution authoring tools come with automatic README generation support. At least in the case of Module::Install::ReadmeFromPod and the various Dist::Zilla plugins I've seen, that generation occurs when Makefile.PL is run. For reasons related to my workflow, Git and GitHub, that timing is too late for me. So I've added a README generation feature to githook-perltidy. See the documentation for details.

One final thing to note. This latest round of work on githook-perltidy was triggered by an unrelated minor issue that a user raised. So don't hesitate to let the author of a tool know when you use something, and that you find it sub-optimal. It might just motivate them to do a bunch of work.

My First Talk at The Perl Conference in Glasgow 2018

I am giving a short talk on "How to become a CPAN contibutor?" at the The Perl Conference in Glasgow 2018. This is going to be my first ever talk at the European Perl Conference. I have already prepared the first draft of the slides for my talk. I will be doing final cleanup in the next few days. I have also got the hotel and train tickets booked.

For a change, this time I am taking my family with me. The plan is to have Glasgow City tour one day and one day Edinburgh City tour with the family.

Before I was mostly associated with London Perl Workshop for obvious reason as I live in London. Few months ago, I got the opportunity to attend German Perl Workshop 2018 in Gummersbach. I must say, I was very impressed with the way the event was handled by capable team of organisors, specially Jens and Roland.

Even More Moose API

Its even more moose day here in the Moose-Pen

For those of you who might have been a little disappointed that there has not been much Moose in my posts of late today you are in for a treat.

Yesterday I had the problem where I may have a nice Database::Accessor all set up that returns all the people in a DB. Good and nice but now I wanted to group them by 'region' which I could do like this;

$address_da->only_elements({region=>1});
$da->add_gather({elements => [{name => 'description',
                                                       view => 'region'}]});
but there is no way I can get a count of users as I had no way to add this aggregate function

Introducing: Newcomer Guide to Contributing to Core Perl 6

Read this article on Rakudo.Party

An important part of a project is to keep a steady flow of new volunteers coming on board to help you out (that's Hug 1: Gift a Shovel in the Hole Digging Metaphor). Starting out can be difficult: you barely know the people who you're working with and you're not familiar with the codebase or the build toolchain. A bug that will take a regular coredeveloper a minute to fix, test, and ship, might be insurmountable for someone who doesn't know where to start.

Perl 6 can especially benefit from newcomer help, as core development is very easy to get into: a lot of bugs involve pure Perl 6 code, mixed with some NQP subroutine calls that aren't much different than using subroutines from an ecosystem module.

Exploring Type::Tiny Part 1: Using Type::Params for Validating Function Parameters

Type::Tiny is probably best known as a way of having Moose-like type constraints in Moo, but it can be used for so much more. This is the first in a series of posts showing other things you can use Type::Tiny for.

Let's imagine you have a function which takes three parameters, a colour, a string of text, and a filehandle. Something like this:

  sub htmlprint {
    my %arg = @_;
    $arg{file}->printf(
      '<span style="color:%s">%s</span>',
      $arg{colour},
      $arg{text},
    );
  }

Nice little function. Simple enough. But if people call it like this:

  htmlprint( file => $fh, text => "Hello world", color => "red" );

... then they'll get weird and unexpected behaviour. Have you spotted the mistake?

Machine learning in Perl: Kyuubi goes to a (Model)Zoo during The Starry Night.

Hello all, this is a fourth blog post in the Machine learning in Perl series, focusing on the AI::MXNet, a Perl interface to Apache MXNet, a modern and powerful machine learning library.

If you're interested in refreshing your memory or just new to the series, please check previous entries over here: 1 2 3

If you're following ML research then you're probably well aware of two most popular libraries out there, Google's TensorFlow and a relative newcomer to the field but rapidly gaining widespread acceptance, Facebook's PyTorch.

The reason why PyTorch has gained so much ground on TensorFlow is in dynamic nature of that library. TensorFlow started as a static graph library (which is easier to optimize) and PyTorch went with dynamically allocated graphs and NumPy (read PDL) style of programming (with a robust GPU support and auto-differentiation of the gradients) that is as easy to debug as an ordinary Python's code.

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.