Test Catch-up Moose

It test post-ette day here in the Moose-Pen

Why stop a habit and as usual ona Saturday I am goting to to a quick post on the current state of the test suite for Database::Accessor and Briver::DBI.

Not a lot of changes in Accessor today
3 files changed, 151 insertions(+), 48 deletions(-)
So I am not expecting many new fails it any.

The start of the GraalVM/Truffle experiment

Recently GraalVM 1.0 been released which can run Ruby, JavaScript and other dynamic and static languages on top at super fast speeds.
I have decided to see how Perl 6 will run on top of it.
If successful that should allow us to run Perl 6 hopefully very fast and use Java, Ruby and JavaScript libraries without paying a interoperability price.

Truffle which is what we are using is a language implementation frameworks that creates an efficient JIT from a (sufficiently annotated) AST interpreter written in Java.

The implementation lives in the 'truffle' (https://github.com/perl6/nqp/tree/truffle) branch of the nqp repo.

nqp-truffle run the first NQP test today and I expect to get many more to pass in the coming days.

I Got Six (YAPCs)

[This is my sixth YAPC / TPC—technically, my first TPC.  If you like, you can read about my other YAPC experiences: YAPC 2011, YAPC 2013, YAPC 2014, YAPC 2015, YAPC 2016.]


After missing a year last year, I came back to attend YAPC this year.  (Yes, yes: “The Perl Conference,” now.  But it’ll probably always be “YAPC” to me.)  And I actually spoke again (second time), this time on dates and my Date::Easy module.  If you missed it and are interested in watching it, the video is up.

This year was in Salt Lake City again, and, while I normally don’t like repeating cities (mainly because I like visiting new places instead), I do have to say the Little America Hotel is every bit the excellent venue that I remembered.  Plus it’s just barely close enough to where I live that I can drive there and take the whole family, and do a sort of “conferenscation.” Which is what we did.

My highlights from this year:

COED:ETHICS 2018

A group of Perl companies are sponsoring the COED:ETHICS conference, a one-day conference on ethics for developers and technologists, which is in London on July 13th.

Moore Moose That I though

It carry on day here in the Moose-Pen

Today I am just going to carry on with a few 'xt' tests in my '25_exe_array.t' test case. Now I started out wanting to do an update with the execute array so I came up with this test;

$da->reset_conditions();
my $update_people = $people->update_people_data();
my $updated_people = $people->updated_people_data();
ok($da->update($dbh,$update_people),"Update Four New Users ");
ok($da->result()->effected == 4,"Four row effected");
Fortunately before I ran this I realized that the above is not going to do what I expect it to do. I think it will just update all the rows in the db four times each wilt an sql like this;

perldoc.pl - A new way to perldoc

For the past decade or more, perldoc.perl.org has been a useful and convenient resource for viewing perl documentation online. However, it has suffered from lack of maintenance and mounting unfixed issues over the past few years. Being familiar with the excellent Mojolicious documentation site and how it also can display core perldocs, I reasoned that such features would be simple to provide in this modern framework. And so, what would become perldoc.pl (thanks to a domain acquired by pink_mist) was born.

Publish your gitlab project to CPAN using App::pause

Many people moved from GitHub to GitLab after annoucing that microsoft bought GitHub. So did I.

After some initial problems with the settling in, it works quite well. GitLab and the integrated CI is very useful to automatically upload your projects to CPAN if all tests are positive.

The steps are quite simple:

1.) Start with some project on gitlab. It doesn’t matter which one.

2.) On gitlab you can configure the some ci settings in your project

  • https://gitlab.com/profile/Your-Project/settings/ci_cd
  • in Variables you’ve to insert:
    • PAUSE_USER
    • PAUSE_PASSWORD
      Why here? Because you don’t want to shour your username and passwort in the build log.
      These variable are available in the CI-Job

3.) Add .gitlab-ci.yml like this example:

"Parsing left recursions"

My latest Ocean of Awareness blog post is "Parsing Left Recursions".

"A lot has been written about parsing left recursion. Unfortunately, much of it simply adds to the mystery. In this post, I hope to frame the subject clearly and briefly."

Moose Still Extends

Back into extended test mode here in the Moose-Pen;

Time to get back to some more practical tests as I have been side tracked by a few API issues. Just to re-cap the practical tests are found in the 'xt' dir and I am using them to test Driver::DBI against a real DB. So far this practical testing has sniffed out a whole lot of bugs and I am hoping to sniff out a few more.

Today I am am going to play with the DBIs 'execute array' this should be totally transparent to the end user all I need to do is pass an 'Array-ref' into my $da as the container and DBI::Driver should do the rest.

First I will need some more data and I added;

Long Import Lists (and available strategies for managing them)

I ran across this the other day while writing some sample code for the next chapter of Testing Strategies for Modern Perl.

How can we use long lists of symbols from an imported package and still keep the code readable?

I usually prefer use statements of the form:
use My::Module qw(symbol1 symbol2 symbol3);

Except for specially understood modules, like Moose and Test::More, I don't like to just import everything. Rather I like to explicitly call out only the specific symbols I need.

But what if you need to:
use My::Module qw(
    symbol1 symbol2 symbol3 symbol4 symbol5 etc and so many symbols
    that it takes up several lines all the time in every package
    that uses it
);

There are a few alternative approaches.

Swat v. 0.2.0

With upcoming version 0.2.0 swat removes usage of prove as internal test runner. There are some -minor- breaking changes due to this. For those who uses swat I would recommend to read GH pages docs and in case you'll need help with migration of your project to the latest swat version don't hesitate to contact me.

Regards

Alexey Melezhik

Perl 6 Colonpairoscopy

Read this article on Rakudo.Party

If I were to pick the most ubiquitous construct in the Perl 6 programming language, it'd most definitely be the colonpair. Hash constructors, named arguments and parameters, adverbs, and regex modifiers—all involve the colonpair. It's not surprising that with such breadth there would be many shortcuts when it comes to constructing colonpairs.

Today, we'll learn about all of those! Doing so will have us looking at the simplest as well as some of the more advanced language constructs, so if parts of this article make you scratch your head, don't worry—you don't have to learn all of it at once!

PART I: Creation

Colonwhaaaa?

The colonpair gets its name from (usually) being a Pair object constructor and (usually) having a colon in it. Here are some examples of colonpairs:

Still in the API Moose

Still API clean up day here in the Moose-Pen

It has been a long running battle between myself,m the API and the the 'Link' objects. A number of posts over the past few weeks have been dealing with how to handle the 'view' for the various elements on link.

Today I started down the path of enforcing the API rule that all 'elements' in a link must have a view. So given this link;

"Marpa and combinator parsing"

"Marpa and combinator parsing" -- the Marpa algorithm as the basis of better combinator parsing.

This is the second post of a pair on my Ocean of Awareness blog. (The first one was "Marpa and procedural parsing")

More intelligent searches in Geo::Coder::Free - part 2

Being lazy, I thought to myself, "when using the web interface, why should I need to add my country to the query?". So, using CGI::Lingua which is already available via the VWF system used to build the site, you longer need to do that. From the US, try this:

curl 'https://geocode.nigelhorne.com/cgi-bin/page.fcgi?page=query&q=Rock+Bottom,+Bethesda,+MD'

With VWF it was a minor change:

$rc = $geocoder->geocode(location => $q);

if(!defined($rc)) {

if(my $country = $self->{_lingua}->country()) {

$rc = $geocoder->geocode(location => "$q, $country");

}

return '{}' if(!defined($rc));

}

Assert::Refute - a unified testing and assertion tool

Unit tests are great. They show that the code was actually designed to a given spec.

Runtime assertions are great. They show that the code is actually running the way it was designed when applied to real data.

Design by contract is a great concept, but it's a bit of an overkill for most projects.

However, sometimes I feel an urge to just rip several lines from a unit test and put them right into production code. Test::More doesn't help here much since my application isn't really meant to output TAP or run in a harness.

So I started out Assert::Refute to narrow the gap:

Clean up Tail End Moose

Its clean up day here in the Moose-pen

There are still a few little things to clean up before I move away from record-sets. The first issue I think would be when I have asked for a 'Class' with 'da_result_set' but I have not supplied a 'da_result_class'.

In my Driver::DIB code I did add in this;

if ($self->is_Class() and $self->da_result_class()){
where it checks to ensure the class is present but I think in the way I am designing the API I should die well before this as I do in a number of other similar situations. So to accomplish the above I will first write up a test in good old '20_dad_load.t'

Perl 6 CaR TPF Grant: Monthly Report (June, 2018)

This document is the June, 2018 progress report for The Perl Foundation's Perl 6 Constant and Rationals Grant.


Tangibles

The bonus deliverable "Perl 6 Numerics" Language documentation page was merged to master. It describes all of the available Perl 6 numerics, their interactions, suitability, and hierarchy.

The bulk of work on constants also has been merged to post-release-2018.06 branch, which will be merged to master after this month's release. I wrote 200 spec tests, available in S04-declarations/constant-6.d.t spec file, and about 500 words of documentation to cover this work.

Rationals

Since my last report, I first continued working on Rationals, focusing on three pieces of work that currently reside in car-grant-unreduce branch

  1. Fixing the rare data race and doing some optimizations
  2. Fixing bad math in some ops with Zero-Denominator Rationals (ZDRs)
  3. Attempting a trial implementation where ZDRs are marked with a role, allowing us to improve performance of some operators.

"Marpa and procedural parsing"

The newest post on the "Ocean of Awareness" blog is "Marpa and procedural parsing" : Marpa's procedural parsing is more flexible and more powerful than recursive descent's.

A short video introduction to App::rs, the first reference counting CPAN client.

Youtube link.

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.