adventure with PVS-Studio C/C++ analyzer

I've recently read a promo article about a static C/C++ analyzer called PVS-Studio by, where the readers were urged to use the product, and I did just that. Evgeniy Ryzhkov, the creator of the program kindly sent me a one-week key, and I immediately started testing some of my C/XS code.

I'm also using valgrind and was rather sure that all major problems were long gone, but how wrong I was. There were also a couple nasties, in cases not covered by tests, and thus valgrind had no chance to detect them. There were also a couple of WTFs, such as

void * x = result();
x-> something++;
if (!x) return;

where the logic was clearly there, but somehow on wrong lines. A shame really.

Update on rakudo.js

Current State

rakudo.js (Rakudo compiled to JavaScript) compiles 70% of the core setting.
I'm working on getting it to compile the whole setting.
The setting executes a bunch of code at compile time (it has BEGIN blocks, constant declarators etc.) so the code the compiler is generated is validated to some degree (the test suit will exercise it much more).
I'm mostly fixing bugs, and implementing missing features in the backend (most are small some required bigger changes to the way we handle things, like nqp::attrinited).
While doing that I'm also expanding the nqp test suite so that new backend implementers have an easier job.

What's left?

Fixing bugs and missing features found while running the test suit.
Writing a tutorial and making rakudo.js more usable (making sure the source maps are correct, it installs easily, the error messages it produces are usable etc.).

When it will be done?

A large part of the work remaining is bug fixing so I find it hard to provide a reliable estimate.
I hope to wrap things up by the end of the year.

Perl6::Parser available for Perl 6

It’s by no means complete, but it’s available for trial from your friendly neighborhood Panda installer. This tool uses Perl 6’s own internal parser in order to generate a parse tree for Perl 6 code, and has enough information to reconstruct the original Perl 6 source, complete with whitespace and comments.

perl6-Perl6-Parser is available in the ecosystem for trial. It’s very much rough around the edges, and can so far handle only a relatively narrow range of Perl 6 code, but that will quickly change, I’m sure. Once it’s further along you should be able to integrate this into things such as pretty-printers, editors, syntax highlighting and other tools. It takes compilable Perl 6 source and generates a tree of Perl 6 objects, which themselves have a .perl6 method to return the original Perl 6 source. Or feel free to override the .perl6 method and format your Perl 6 code how you want it.

Perl 5 Porters Mailing List Summary: September 29th - October 10th

Hey everyone,

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


So I'll confess that I've had a big crush on Haskell for a couple of years now. I've tried and failed many times to really get beyond trivial code, but I'm utterly fascinated by the code one can write with strong, static typing. It can feel contrived at times and very constraining, but I can definitely see the benefits, which is why I'm so excited that Perl 6 has (gradual) types!

Dancer2 0.204000 improves app config, content caching, and dependency management

Fresh off of Perl.Dance 2016 is Dancer2 0.204000. The latest version of Dancer2 is on its way to a CPAN mirror near you.

This version brings some compelling enhancements and features:

  • Improved configuration handling (Jonathan Duff):

You can now create a local version of your configuration files which you then do not need to commit to any repository. If you create a file called config_local.yml, you will have a local config.yml. You can do the same with any configuration file, just change the filename to end with _local.

You can now set the DANCER_CONFIG_EXT environment variable in order to only load configuration files of a particular type (such as JSON). For example: DANCER_CONFIG_EXT=json plackup bin/app.psgi

You can now get some diagnostics information about loaded conifguration files by setting the DANCER_CONFIG_VERBOSE environment variable to a true value.

  • Improved static content caching:

Automating deployment of my personal Perl projects with Dokku

Last weekend I completed an article about deploying my personal Perl projects using Dokku - it might be interesting if you have similar needs!

Split amino acid and nucleotide sequences

A labmate got a FASTA file of sequences that had a mix of amino acids and nucleotides that she wanted separated into separate files. Here's a little script to do that. Again, I wish there was an easier way to get the basename for a file that does not have the extension.

#!/usr/bin/env perl6

sub MAIN (Str $file) {
    my $ext   = $file.IO.extension;
    (my $base = $file.IO.basename) ~~ s/\.$ext$//;
    my $dna   = open "$base.fna", :w;
    my $aa    = open "$base.faa", :w;
    my $fh    = open $file, :r, nl-in => '>';

    for $fh.lines -> $rec {
        next unless $rec;
        my ($header, @seqs) = $rec.split(/\n/);
        my $seq = @seqs.join;
        my $out = $seq ~~ m:i/^<[actgn]>+$/ ?? $dna !! $aa;
        $out.put(join("\n", ">$header", $seq));

    put "Done.";

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