Using Docker to Check for Prerequisites

While updating Set::Jaccard::SimilarityCoefficient to v1.6.1, I realized that I should install it on a clean, clean system so I find all missing prerequisites (not just the ones I already knew about). So where do I get a clean, clean system? Aha - a minimal Docker container (like the plain-vanilla Ubuntu 16.04 LTS) would be just the ticket as I am using an Ubuntu 16.04 LTS laptop. As an example, here are the steps I ran through:

  • Run: "sudo docker run -v /home/mark/src/perllib/Set-Jaccard-SimilarityCoefficient/Set-Jaccard-SimilarityCoefficient-1.6.0:/Set-Jaccard-SimilarityCoefficient-1.6.0 -it ubuntu".

  • Because this is a plain-vanilla Ubuntu, I need to install some development tools (including missing pieces of Perl) by running: "apt-get update; apt-get install gcc make perl-modules-5.22". Followed by: "cpan -i App::cpanminus"

(If anyone points out in the comments how I could use the direct "curl" install for "cpanm" rather than using "cpan", I will update these directions.)

Strings in YAML - To Quote or not to Quote

+++ This article has been refurbished and moved to +++

www.yaml.info/learn/quote.html

(June 2020)


Old version:

This article covers scalar styles in YAML 1.1 and 1.2. It mostly works the same in both versions.

YAML is a data serialization language, and one design goal was that it's human friendly. It should be easy to read and edit, even if that makes parsing it harder.

Let's look at strings, specifically.

If you look at JSON, you have only one style to encode strings, and that's the double quoted style which doesn't allow literal linebreaks.

YAML files are used for many different purposes, and there are many types of strings, especially multiline strings. For each use case, you can choose the type of quoting (or no quoting) that makes the string readable and easy to edit.

This gives you lots of freedom, but you also have to learn using it to avoid mistakes.

Not Tomorrow for Moose

No!! Still on a case here in the Moose-Pen.

I just started my first test for '22_fields_extended.t' and then I saw one other little point I forgot to take into account. I should add in some validation for my 'Case' class as it is invalid to have a case that has only one condition.

Therefore this test;

Videos for London Perl Workshop 2017

The organisers of the London Perl Workshop 2017 are very happy to announce that the videos of the talks are now on YouTube. In the rest of this post we'll give a summary of the videos, with links to each talk.

Set::Jaccard::SimilarityCoefficient v1.6.1 Released

Somehow I missed most of the prerequisites for Set::Jaccard::SimilarityCoefficient, so I have released a version v1.6.1 that:

  • Has all of the prerequisites in the Makefile.PL.

  • Uses the new (and internally simpler and more correct) ReadonlyX instead of the retired warhorse Readonly.

  • Has additional Kwalitee tests in t-kwalitee/.* (All Kwalitee tests pass.)

(This passes most of "perlcritic --theme pbp" except for the unknown word in POD and the POD before END checks.)

Enjoy!

Safely load untrusted YAML in Perl

Usually people deal with YAML files from trusted sources. But maybe you want to load input from a Website as YAML. This can lead to problems, and this article will talk about what you can do to make the loading safe.

The problems I'll talk about are loading objects, cyclic references and general parsing problems.

I will cover YAML.pm, YAML::Tiny, YAML::XS, YAML::Syck and YAML::PP.

Maybe Tomorow Moose?

Oh well! Still stuck in DA day here in the Moose-Pen.

Well I still have a little more work to do as I just read that you can have a 'case' in a 'Join/link' as this;

App-RemoteCommand

Last Friday, kichijojipm was held at Shinjuku, Tokyo, Japan. It is a japanese local Perl Monger group organized by magnoliak. The talks were about not only Perl but also a wide variety of subjects.

I talked about App::RemoteCommand there, which is a simple remote command launcher via SSH, built on top of an excellent module Net::OpenSSH.

Here is the slide. I hope you try it!

Perl 5 Porters Mailing List Summary: February 1st-11th

Hey everyone,

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

Enjoy!

Easily back up your Github repositories and/or issues

It's been in the works at the lower-end of my priority list, but after having a bit of a bug-closing weekend, thought I'd tackle getting out an initial release of Github::Backup.

The cloud is a great thing, until the sun evaporates it one way or another. Github, although fantastically reliable, is prone to issues just like any other site on the Internet. I'd go as far to say that even they could be prone to data loss in very rare circumstances.

This distribution, which provides a command-line binary, allows you to quickly and easily back up your repositories and issues to your local machine. The repositories are cloned so all data is retrieved as-is as legitimate Git repos, and the issues are fetched and stored as JSON data. Useful if there was ever a catastrophic issue at Github, or simply for offline perusal of your information.

More Moose Case Tests

It't clean-up test day again here in the Moose-Pen

Well over the past few days I seem to be just about ready to go back to Driver::DBI but I find yet another little thing wrong with my Database::Accessor when playing with my new test Class.

The first thing is to clean up the test case '15_case.t' as it hard 255 fails with;

Can't call method "statement" on unblessed reference at 15_case.t line 281.
That one is really just an update to take into account yesterday's change from a flat array-ref to an array-ref that can contain other array-refs and the final tests now like this;

Finally, a BNF for Perl 5 regexps: The Regexp::Parsertron

See Regexp::Parsertron V 1.00.

Current users of Regexp::Assemble may find something of interest there.

Perl 5 Porters Mailing List Summary: January 10th-31st

Hey everyone,

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

Enjoy!

YAML::PP Grant Report January 2018

Hi,

thanks for reading my report. This report will be quite short because I have been busy with other things, and a lot of time went into discussions rather than coding, and I never logged time for discussions.

I have been working on YAML::PP about 10 hours.

See also my previous reports on blogs.perl.org (Aug/Sep, Oct, Nov, Dec )

Moose Cracks Case!

It still stuck on Case here in the Moose-Pen

Same sort of story as my last post I as looking at my tests and just cleaning up a few typos and a little perl tidy and I notice the when I have a 'case' like this;

Call for Tutorial Sessions

Are you an experienced instructor or speaker who would like to offer a course at The Perl Conference this year in Salt Lake City?

Great! We hereby invite you to participate by submitting a Tutorial Session!

We would like to offer the Perl community a selection of courses and tutorials before and after the conference. This is your chance to be a part of that.

Tutorial Sessions can be a half day (3 hours), full day (6 hours) or 2 days in length and will run on Sunday 17th, Thursday 21st, or Friday 22nd of June.

To submit your proposal please complete the following information here: https://goo.gl/forms/WUj0IBwzjZDL0xaf1

Mocking Should Not Require Interfaces

Exploring the ecosystem outside Perl, I have found multiple examples of languages and frameworks that require you to implement your classes as an interface + an underlying engine class when you want to mock that class during testing. This is all fine and dandy if the interface can be used as part of multiple classes. However, if the only reason you have an interface is so you can mock this class during testing, then I would call that a language-runtime smell.

If you are never going to use the interface for anything other than mocking, then you are violating both DRY (Don't Repeat Yourself) and YAGNI (You Ain't Gonna Need It). Using interfaces requires synchronizing method signatures between the interface and its classes, thereby violating DRY. If the interface is only used for mocking that class, your are violating YAGNI. DRY and YAGNI reduce your code complexity, making it easier for you to understand your code later (and you always have to understand your code later).

Next stable DBD::SQLite will be released at the end of February

It's been a year since the last stable DBD::SQLite was released. Actually, it's been a year and a half since the SQLite library bundled in the last stable DBD::SQLite was released by the upstream. A lot have happened there, and some here. It's time for you to test them all against your applications/modules, at last.

DBD::SQLite 1.55_07 (with SQLite 3.22.0) is a release candidate of the next stable DBD::SQLite. It has various query planner improvements, optimizations, performance enhancements, and bug fixes, especially on LEFT JOIN queries, IN and OR operators, and WITHOUT ROWID tables. It also supports "row values", that means now you can write a query like this:

UPDATE foo SET (id, text) = (SELECT id, text FROM bar WHERE id = 1);

Follow the links in http://www.sqlite.org/chronology.html, or each of the following links, to see full details.

Moose Stuck on Case

Its change my case yet again day here in the Moose-Pen

Yesterday as I had finishing off my tests for the Case class I was just about to move over and start writing up the code for Driver::DBI when I remember that I should have a test or two to ensure that Database::Accessor can use the new 'Case' class and that is passed it correctly down to the DAD.

I am using it right now as a field and I can test by just adding to the '31_elements.t' test case.

Frist I add in just a simple 'case' as I have already tested all the funny permutations in the '15_case.t' test case;

Lab::Measurement at DPG Spring Meeting in Berlin

The Lab::Measurement module stack will be featured with a poster at Europe's largest physics conference this year, the DPG Frühjahrstagung (Spring Meeting) of the Condensed Matter Section, Berlin, march 11. - 16. 2018.

So please come by on Monday, March 12, 2018, 15:00–19:00, Poster B, TT 29: Poster Session: Cryogenic Particle Detectors and Cyotechnique.

If you cannot wait until march, please consider the Perl in the Physics Lab presentation at FOSDEM by Andreas K. Hüttel, my supervisor, next weekend!

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.