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

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

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

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

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!

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.

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

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.

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!

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;

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.

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!

Dist::Zilla On Style

Even more POD here on the Dist-Pen today.

I my last post I finally figured out how Pod::Weaver works, a template, weaver.ini file, that has 'Sections', [Name], [Author] etc, that you can change to create your POD document.

I wanted to test just how Pod::Weaver works so I replace '@default' in my 'weaver.ini' whith what the source code of Pod::Weaver::PluginBundle::Default said it was supplying;

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.

Introducing JIRA::REST::Class

Over the past couple months, I've had to take over project management for my DarkPAN project at $EMPLOYER, and the software they're enamored of for that purpose is JIRA.

Unfortunately, JIRA can be a pain in the ass sometimes, and since we're not the only group at $EMPLOYER that uses JIRA, getting things set up the way we need them is not always possible. However, it was possible to manually go through and fix up issues to our standards...

Well, whenever something is manually possible, I look for a way to automate it. I quickly discovered that JIRA has a REST API, so I went looking for a tool to help me use it in Perl.

I found JIRA::REST.

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.