Dist::Zilla Hates Leftovers
Well POD post-ette day again here in the Dist-Pen
In my last post I had a look at the [Collect] section plug-in and how you can use it to gather up similar parts of your POD in to one section in a document. Useful when you want to keep the POD next to the code but you have a mix of function attributes and subs in the code for other valid reasons.
Today I am looking aI would guess would be the simplest plug-in to use [Leftovers]. As the name implies it dump any Pod that has not been put into another section.
In the case of the [@Default] template it is here;Amusewiki 2.0
Happy winter solstice, Perl community!
After almost 3 years of development and more than 2 years in production, 2 talks at YAPC::EU (Granada and Cluj) and one talk at the Dancer conference last year in Vienna, I think it's time to announce Amusewiki on blogs. perl.org as well, as I consider it more or less feature complete and robust enough for a larger audience.
Amusewiki is basically a CMS, but it's not "yet another one". Its main feature is that it creates for each published text various PDF (via LaTeX) and EPUB (for e-readers and mobile devices) files, along with an HTML version. It's also able to produce slides. Also the bookbuilder provides a way to extract, merge and customize the texts stored in the archive. You may want to give amusewiki a try if you're interested in publishing and distributing texts. If you just need a wiki or a blog for posting code snippets and lolcats, you probably want to look elsewhere. Amusewiki is suitable for publishing whole books as well.
Perl 5 Porters Mailing List Summary: December 12th-18th
Hey everyone,
Following is the p5p (Perl 5 Porters) mailing list summary for the past week.
Enjoy!
DBD::mysql - all your UTF-8 bugs are belong to us!!□□
After a couple of years of more or less "maintenance mode" on DBD::mysql - we had a hand full of people contributing occasional fixes and a whole slew of drive-by contributors - we now have a prolific contributor again: Pali Rohár.
It's great to see some more long-standing issues taken care of!
This time around, in the new development release 4.041_01 that is on CPAN now, there are some important fixes for some Unicode-related issues that I would like to point out. The sections below I have distilled based on the descriptions made by Pali.
Automatically converting to UTF-8 for bind parameters
Before this release perl scalars (statements or bind parameters) without UTF8 status flag were not encoded to UTF-8 even if mysql_enable_utf8 was enabled. This caused perl scalars with internal Latin1 encoding to be sent to the mysql server as Latin1 even if mysql_enable_utf8 was enabled.
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;Working with the MetaCPAN API
This is the fourth article in a series about MetaCPAN. The first article described the two main parts that make up the MetaCPAN project: the API and the search interface. The second article gave a high level overview of how the API uses Elasticsearch to hold and search information about CPAN distributions and authors. The third article showed how MetaCPAN fits into the rest of the CPAN ecosystem.
In this article we'll show how you can use the MetaCPAN API to get information about releases to CPAN. We'll start off with a very simple query, then gradually refine it to narrow down which releases are returned, and what information you request for each release.
This article is brought to you by Elastic, who were a Gold sponsor for meta::hack. We were very happy to have their support, especially given the central role that Elasticsearch plays in MetaCPAN.
Let the fake times roll...
In my $dayjob at GetResponse I have to deal constantly with time dependent features. For example this email marketing platform allows you to use something called 'Time Travel', which is sending messages to your contacts at desired hour in their time zones. So people around the world can get email at 8:00, when they start their work and chance for those messages message being read are highest. No matter where they live.
But even such simple feature has more pitfalls that you can imagine. For example user has three contacts living in Europe/Warsaw, America/Phoenix and Australia/Sydney time zones.
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.
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)
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 addClosures, 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.
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.