C::Blocks Advent Day 10

This is the C::Blocks Advent Calendar, in which I release a new treat each day about the C::Blocks library. Yesterday I dug into the details of writing a type that can be used with C::Blocks. Today I explain how to use C::Blocks in multithreaded Perl code.

Dist::Zilla Collects

Its collection day here at the Dist-Pen.

In my last post I looked at the rather plain but useful [Generic] section plug-in, that lets the Pod writer control where any section of POD that begins with =head1 can be moved to anywhere on the page. Today I am going to look at another of the often used plug-in the [Collect] section or plug-in.

This section is used to gather, group collect or otherwise gather together items under a named '=head1' tag what have the same POD tag. Looking at the [@Default] template again you will see there are three of them;

Heap's Algorithm and Generating Perl Code From Pseudocode

I've been researching recursion lately and in particular, permutations algorithms. This interest was spurred by a real-life case where such an algorithm would come in handy (combinations of @clients, @users, @tickets). I came across Wikipedia's entry for Heap's algorithm and the pseudocode illustrating the algorithm. I found the non-recursive version even more interesting specifically for its lack of needing to call itself, so I chose that version of the algorithm to study.

more

Testing Mojolicious applications with Sparrow

A bits of theory

In this post I am going to show how you can use Sparrow to test Mojolicious applications.

Sparrow approach to test things differs from convenient unit tests approach, practically this means:

  • A tested code is treated as black box rather than unit test way where you rely deeply on inner application structure.

  • A sparrow test suites are not a part of CPAN distribution ( the one you keep under t/* )

  • A sparrow test suite code is decoupled from tested application code and is better to be treated as third party tests for your application

  • Sparrow tests suites have it's own life cycle and get released in parallel with tested application

  • Sparrow acts like toolchain to choose proper tools and then analyze script output

  • IMHO writing sparrow tests sometimes is much simpler and takes less efforts and time, but I don't say you don't need a unit tests but sometime it worths it to take an alternative testing approaches / tools and see the difference , so if you are interested , please read below ...

C::Blocks Advent Day 9

This is the C::Blocks Advent Calendar, in which I release a new treat each day about the C::Blocks library. Yesterday I illustrated C::Blocks::Object::Magic while writing a simple class that had APIs in both Perl and C. Today I dig into one of the keys of yesterday's example: writing a type that can be used with C::Blocks.

Dist::Zilla Generic Model

Sorry still on the all POD diet here at the Dist-pen today

In my last post I had a look at custom [Region] section and how that section lets you define your own custom tags you can use in you POD. Today I am looking at one of the often used sections and one of the more simple ones the [Generic] section.

If you look at the [@Default] template you will see no less than fours calls to this plug-in

...
[Generic / SYNOPSIS]
[Generic / DESCRIPTION]
[Generic / OVERVIEW]
[Collect / ATTRIBUTES]
...

MadMongers (Madison Perl Mongers)

MadMongers (Madison Perl Mongers) :

I have an idea for a year-long series of presentations for MadMongers. Come listen and share your thoughts.

[From my blog.]

Closures, alternatives, map in Perl 6

In a script I recently wrote, I employed a few features of Perl 6 that I'd like to highlight. I'm using Mash to create a distance matrix of samples (usually metagenomes or genomes) to each other, either in a complete pair-wise fashion or some set (like the Pacific Ocean Virome) to some new set of samples.

The output of Mash is a tab-delimited file. The first line contains the column headers, and the first column is the literal string "#query" followed by all the sample/file names which include the relative path information. Here is a sample:

#query  fasta/L.Spr.C.1300m.fa  fasta/M.Fall.O.105m.fa  fasta/L.Win.O.10m.fa    fasta/SMS.Spr.C.5m.fa   fasta/M.Fall.I.10m.fa   fasta/L.Sum.O.2000m.fa  fasta/M.Fall.O.1000m.fa fasta/M.Fall.O.4300m.fa fasta/L.Spr.I.2000m.fa  fasta/L.Spr.C.1000m.fa  fasta/L.Spr.O.2000m.fa  fasta/M.Fall.C.10m.fa   fasta/L.Spr.O.10m.fa    fasta/SFC.Spr.C.5m.fa   fasta/SFS.Spr.C.5m.fa   fasta/L.Sum.O.500m.fa   fasta/L.Spr.I.10m.fa    fasta/L.Sum.O.10m.fa    fasta/L.Spr.I.500m.fa   fasta/L.Spr.C.10m.fa    fasta/GD.Spr.C.8m.fa    fasta/M.Fall.I.42m.fa   fasta/L.Win.O.1000m.fa  fasta/L.Win.O.500m.fa   fasta/M.Fall.O.10m.fa   fasta/SFD.Spr.C.5m.fa   fasta/L.Spr.O.1000m.fa  fasta/STC.Spr.C.5m.fa   fasta/L.Spr.I.1000m.fa  fasta/L.Sum.O.1000m.fa  fasta/L.Spr.C.500m.fa   fasta/L.Win.O.2000m.fa  fasta/GF.Spr.C.9m.fa

All the other lines are the reference samples (with relative path information to the index) followed by a value between 0 and 1 indicating the distance (shared genetic content as determined by k-mers in this case) between the samples where "0" indicates identical samples and "1" is completely unrelated:

Perl 5 Porters Mailing List Summary: December 8th-11th

Hey everyone,

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

Enjoy!

Dist::Zilla Regional Report

Good Meal day here in the Dist-Pen

So in my last post I had a look at a the little more complex [Version] section plug-in for Pod::Weaver and Dist::Zilla. How the user can change the format of the section and even use some passed in variable, identified with a '%' in a section template.

Today we are going to look at one of the Meat and Potato sections the [Region]. This section allows you to place you own custom section or 'region' where-ever you want in your document. This is accomplished by using Pod::Weaver 'tags' which are simply text starting with a ':'

To start a 'region' one just needs to add

C::Blocks Advent Day 8

This is the C::Blocks Advent Calendar, in which I release a new treat each day about the C::Blocks library. Yesterday I showed one way to build a (mildly) complex data structure, including handling pointers and managing memory. Today I will explain how to tightly control access to pointers using classes and C::Blocks::Object::Magic.

The MAIN Thing

If you're coming to Perl 6 from Perl 5, the global variable @*ARGS will be familiar to you as the place to get the command-line arguments to your program:

$ cat main1.pl6
#!/usr/bin/env perl6

put "ARGS = ", @*ARGS.join(', ');
$ ./main1.pl6 foo bar baz
ARGS = foo, bar, baz

The @ is the sigil that denotes the variable as an array, and the * is the "twigle" that denotes that the variable is a global.  If you follow the above link to the documentation, you'll find a whole host of other dynamic and environmental variables like user, hostname, PID, cwd, etc.

Rakudo.js update

I have added support for uncached methods (ones that are looked up dynamically by find_method on the metaclass instance rather then set by nqp::setmethcache) by putting an ES6 Proxy inside of our prototype chain.

It's the first use of ES6 that isn't merely a convenience as I don't know of a way to do it without that without introducing a serious performance penalty.
Nqp-js has been refactored to use instances of a class with a VMArray repr instead of a custom JS class wrapping array.
After figuring out I need to pass the --max-old-space-size option to node (which stops node.js from aborting rakudo.js if it does a gc run and judges that we use more memory then we deserve even if we have free RAM around), rakudo.js finally compiled the full setting.

Dist::Zilla Plots Version

Even more POD here at the Dit-pen.

In my last postI wrote about the rather simple [Name] section today I am going to move onto something a little more complex the [Version] section.

[Version] does not produce a lot of POD just

=head1 VERSION

version 0.01
in the case of my distribution. It is getting that '0.01' from my 'dist.ini' file

Perl 5 Porters Mailing List Summary: December 1st-7th

Hey everyone,

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

Enjoy!

C::Blocks Advent Day 5

This is the C::Blocks Advent Calendar, in which I release a new treat each day about the C::Blocks library. Yesterday I showed how to declare and share C functions, which I think is C::Blocks’ killer feature. Today I will show some simple benchmarks that illustrate the performance of C::Blocks-compiled code.

Sorry that this Fifth Advent entry is being posted on the Seventh day of December! I got some really weird benchmark results and it took a while to really dig through them and figure out what was going on. I’ll have to work double-time for the next few days to get caught back up!

My first ever talk at London Perl Workshop 2016

On the day of the event, I reached the center at about 8:45 am with plenty of time to go through the registration procedure. I have been attending the London Perl Workshop for the last 4 years. But this year was little special as I was giving a talk, thanks to Neil Bowers. In fact he helped me prepare the notes and sharing his own experiences.

I was assigned "Room 2" for my talk. When I got there I realised that I didn't have the right connector to connect my laptop with the big screen. Dave Cross was also giving a talk in the same room and he suggested I talk to Mark Keating. Luckily, Mark had spare connector for me. I was sorted and ready to go. I still had 3 hours before my talk, so I attended the talk by Dave Cross about what new features added to perl.

Dist::Zilla Takes it in the Name

Another Pod post here in the Dist-pen.

In my last post one saw how you can change the order of the 'sections' of your POD by simply not using the '@Default' template and using you own custom template. You also saw haw you can use other peoples templates by simply installing them and the swapping them out for the [@Default] template.

Today I am going to have a closer look at the [Name] section.

This is one of the more simplistic section templates, it only produces the following;

=head1 NAME

Database::Accessor::Manual - What is Database::Accessor, and how do I use it?
It will look in your POD fro the following comments
  • # ABSTRACT:
  • # PODNAME:
So to produce the above my original Pod is;

GitPrep v2.5 released today. Theme color become dark blue.

GitPrep v2.5 released today. Theme color become dark blue.

Let's try GitPrep example.

I'm going to implement "wiki" in next release!

C::Blocks Advent Day 7

This is the C::Blocks Advent Calendar, in which I release a new treat each day about the C::Blocks library. Yesterday I illustrated the many ways you generate or modify C source code. Today I discuss basic facilities for handling pointers and building C data structures.

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.