March 2018 Archives

Perl Module Tools (pmtools) v2.2.0 Released - Many RT Fixes

Perl Module Tools (pmtools) v2.2.0 has been released (and updated on GitHub). The focus was on fixing RT bugs. The only outstanding RT issue will be 52851, which is a feature request for pmeth to also display a description for the method. This will require some contemplation to see if I can do this in a reasonably simple manner.

(I say "will be" because rt.cpan.org does not yet have 2.2.0 as a valid version number for pmtools.)

Perl Module Tools (pmtools) v2.1.2 Released - Version Fixed

Perl Module Tools v2.1.2 has now been released to fix the version number everywhere.

Perl Module Tools v2.1.0 Released - Windows Fixes

It turns out there are several tools in the Perl Module Tools (pmtools) that need to execute other commands with the current Perl specified, like:

system "ls -l " . `$^X -S $Bin/pmpath $module`;

(note the additional "$^X").

As a side note, in Windows you may need to "use FindBin qw($Bin);" so your programs can actually find the Perl to run. (I had wondered if this use of FindBin was just cargo-cult programming carried over from old versions of Perl - now I know better.)

Stupid Lucene Tricks: Full-Text Search Without the Full Text

This is a really stupid (and kludgy) Stupid Lucene Trick: how do you search the full text of your document + metadata without the full text? Simple - you create a separate field (call it fulltext, for example), then populate it with the text of all of your other fields. Voilà! You can now search against "fulltext" for all of the text in your Lucene document without having to know whether, for example, "physical" is in the document body, the abstract, or only in the keywords.

Note that fulltext should be created dynamically from the fields for the particular document, rather than from a fixed set of named fields so you maximize the amount of text you can search against.

And yes, you are duplicating the text of the all of the other fields in this field :(.

Lunatics, Perl, and Java

So I don't forget this - my expanded version of something our Larry Wall once said:

"Looking at Perl code, it is easy to tell whether you are looking at the ravings of a lunatic. With Java, you can be several weeks into the project before you realize that you are dealing with the demented discourse of someone who should be trusted with nothing sharper than a spoon."

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.)

  • Run "cd /Set-Jaccard-SimilarityCoefficient" followed by: "perl Makefile.PL" to check for dependencies while we build the Makefile.

  • Finally, run: "cpanm Exception::Class ReadonlyX Set::Scalar Test::Most" to install the missing dependencies (which are noted in the "perl Makefile.PL" step due to my fixes for v1.6.0).

Note that this is applicable to finding the dependencies for any installation - I just picked Set::Jaccard::SimilarityCoefficient because I was working on it yesterday. I could just as well picked a Go program, a Ruby on Rails project, or even Pugs (the Perl 6 interpreter written in Haskell).

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!

About Mark Leighton Fisher

user-pic Perl/CPAN user since 1992.