In this post I try my hand at building a distribution with Dist::Zilla. Here I found out about some of the required attributes that Dist::Zilla needs and how to use my first plug-in and generate my first distibution with dzil and had a quick look at the mass of Plug-in found on CPAN
Carrying on from my first attempts I added in an 'Abstract' into the mix and then started to add in other Plug-Ins to really make a useful distribution for CPAN and learning that dzil has a clean as well as a build command.
We've had a few questions and discussions about the toolchain summit since our announcement in January. In this blog post we'll address some of those: why the name change, what things are fair game to be worked on, and who decides who comes?
The Perl Toolchain Summit is the new name of the Perl QA Hackathon, an event organised for the first time by Salve J. Nilsen in Oslo in April 2008. In Salve's words from 2008: "The purpose of a QA hackathon would be to Quality Assurance-related problems that are easier to solve when everyone is gathered in the same physical location. This can include issues with packaging, testing modules, community support or with tools."
Over time, the event has grown in importance (it is now the major non-conference event of the Perl community), and moved around Europe, organized every year by a different team in a different European city. It is entirely financed by corporate and community sponsors interested in having a healthy and reliable Perl environment.
Today I am looking at the I think the last section plug-in the [WarrantyDisclaimer] plug-in. This is your standard blurb type plug-in that will dump a bunch of legal words that is suppose to cover your arse if someone uses you code to control a self-driving car that goes berserk and crashes into a children's hospital causing a fire as the cute puppy store.
This plug-in has a number of subclasses that you can use to match up the license you are using to the correct subclass. So far there are six sub-clases
Default
Artistic
Custom
GPL1
GPL2
GPL3
Myself as I am using the GPL 3 so in my 'weaver.ini' file all I need to add in is
Its on the 12.03.2017 12:00 in Room V5 and by ... me (you guessed it). It will have a small Perl 5 section handling 5.24 and 5.22 (since i've gone full P6 last year). Ant to not repeat myself i want to go more practical with Perl 6 this time. some nice alorythms and useful modules - answering: what can I do with Perl 6 today.
Been away a while, and now I have a whole heap of bug reports to get through. But you, dear reader, I'm giving the inside track. If there's a bug in one of my modules and you want me to prioritize it, comment below.
Getting near the end of the section plug-ins I am looking at the [Template] plug-in. This one is much like the [GenerateSection] plug-in I had a look at in this post.
To use this plug-in to generate the same section I created in the other post above
=head3 Database::Accessor Tutorial
Welcome to Page xxxxx
I will first have to create that in a file with the {{}} in the right spots. So I created the file 'header.section' with this content;
Welcome to Page {{$name}} of the {{ $main_module_name }} tutorial.
Here’s another
example of code taken, terrifyingly, from a script that a contractor was paid
cash money to write. The contractor’s code included a script to remote into
another system and perform a command. Most systems required ssh, but we had
some older systems that required rsh instead. So the contractor made a
configuration file that contained client definitions:
In the script,
he looked up the client in question, and put its configuration into variables
like $method. So far, so good. But here’s the code that
decides which access method to use:
So this code omits
the sigil on $method—problem #1—and
thus treats method as a bareword
(i.e. the literal string "method"), then compares
that to the literal string "ssh", but does so NUMERICALLY—problem #2. Since both are
non-numeric strings, they are both treated as 0, and the comparison is always
true. Needless to say, this script did not turn on warnings or strict mode—problem #3. Luckily, the vast
majority of our critical systems required ssh, and on those systems, three wrongs
made a “right!”
It is the big 'S' round-up here on the Dist-pen today.
Well just a post-ette today as I am a little hard pressed to find things to blog about. I am going to have a quick look at the three remaining section plug-ins that start with 'S'
[SQL]
[SourceGitHub]
[Source::DefaultGitHub]
SQL
This is a neat little plug-in that I might find useful when I go the write up my DAD::SQL. If you wrap any sql in you POD like this
At YAPC::EU 2016 I gave a talk on my approach to developing code against RESTful services. The talk starts out a little silly, but my aim was to show some of the frustrations that can arise when developing aforementioned code. My conclusion is that you should write an emulator for any service you are developing against. Not just that but release an emulator for any RESTful APIs you are developing for others so they can trivially test their client code.
Of course I am a developer so inherently lazy, and being a perl developer I am especially lazy. Having done the emulation dance for at least three modules I've written I suggested I would write something to make this easier. I managed to find some time last week, amongst our annual developer's conference, to do this.
Some time back we added support to Perl for locked or restricted hashes. (See Hash::Util and fields.pm). The basic idea is that you can set up a hash, and then "lock" it, at which point access to unregistered keys in the hash, either write OR read, will cause an exception.
The basic idea was to work around Perl's lack of a true "struct"/"object" where it would be conventional to have compile time exceptions when accessing a non-existent member, or when accessing a late bound object in many languages which should produce a run time exception. Unfortunately restricted hashes do not support compile time exceptions, so we only get run time exceptions.
Well it is look elsewhere day here in the Dist-Pen today
Getting closer to the end of the road for Pod::Weaver::Section plug-ins I only have a few more to look at so I am going to look first at the ones I might find useful and then do a final wrap up of all the left overs.
Today I am going to look at the [SeeAlso] section plug-in. Fort my Database::Accessor project this might be a good one to have in there. As I will have a number of extra content I might want listed someplace, like links to the tutorial and manual and perhaps a link to a few DADs or a search for DADs
This plug-in does give you a number of options on how to enter the data for the section blurb. The most badsic is to add in the section your self in you pod and then the plug-in will convert them to a list.
Listing BitBucket repositories could be annoying task even though BitBucket exposes a Rest API for this, and the reason for it is pagination - BitBucket sends result back spited by pages, so you need to request a next page till the end. This is hard to automate and prevent me form using BitBucket API directly.
Well, I have dropped a small sparrow plugin to handle with this task. At least it works for me. It lists ( in plain text format ) all the repositories for given project and team. There a lot of option of plugin you will find at documentation but the usual workflow is:
install plugin
$ sparrow plg install bitbucket-repo-list
run plugin
Here you lists repositories for given project and team. You should supply your Bitbucket credentials to request team/project information:
Here are three
fun—and hopefully useful—sort functions.
This first one
sortsstrings with
numeric suffixes (such as room numbers like “White 102”) first by the string
part, then numerically by the suffix. The function assumes the data has been vetted;
i.e. matches $rgx_strnum. Obviously
you may need to tweak $rgx_strnum to meet your specific
needs; you can also add calls to uc to sort the
string part case-insensitively.
our $rgx_strnum = qr/^([A-Za-z]+)\s*(\d+)$/;
sub strnum {
my ($aS, $aN) = $a =~ $rgx_strnum;
my ($bS, $bN) = $b =~ $rgx_strnum;
return $aS cmp $bS || $aN <=> $bN;
}
This function sort
strings ASCIIbetically except blank strings sort to the end—I am always
surprised how often this comes up. As above, you can add calls to uc for a case-insensitive blanks-last sort.
This is a tutorial as much as it is a request for guidance from experienced
XS/C/perlguts folks, as TIMTOWTDI, and in this case, likely, a better way.
This will show you how to pass a Perl array reference (aref) into a C function,
convert the aref into a C array, work on it, then push it back onto the stack
so the C function returns it as a Perl array.
It'll also show that although we bite off of
Inline::C,
the XS code it generates can be used in your distribution, even without the end-user needing Inline installed.
First, straight to the code. Comments inline for what's happening (or, at
least, what I think is happening... feedback welcomed):