I've been writing a lot of software lately that deals with direct hardware access (specifically analog and digital hardware for the Raspberry Pi). This means that I've had to learn some C, as well as get proficient with bit manipulation and the bitwise operators.
As part of my learning, I thought I'd write a module to do this bit manipulation for me, hence Bit::Manip was born. (There's also a Bit::Manip::PP for those who can't/don't want to use XS. It should be indexed shortly).
Here's a scenario based example of how the software can be used.
You have a 16-bit configuration register for a piece of hardware that you want
to configure and send in. Here's the bit configuration
Today I am going to look at [GenerateSection] section plug-in. This one look very interesing to me as it lets on generate a section from with-in the 'weaver.ini' file.
Now in my case I would love to have a common header and footer for my Tutorial pod without having to add the same section over and over again in each POD doc. I am hoping that this plug-in will get most if not all of what I need.
Right now I am just going to go for a simple all text version for now as I am not 100% sure how to get extra variable content into Dist::Zilla and Pod::Weaver.
So we all know
the COMPSCI 101 method of swapping two variables: $tmp = $x; $x =
$y; $y = $tmp;
And we all know the better way of doing it: ($x, $y) = ($y,
$x);
And yet, I
found the following in PRODUCTION CODE, that a contractor was PAID ACTUAL DOLLARS TO WRITE: ($tmp_x, $tmp_y)
= ($x, $y);
($x, $y) = ($tmp_y, $tmp_x); Weird that
they knew about parallel assignment but not that you could just apply it to two
variables directly.
Anyhow, this
wasn’t nearly as bad as the code I found in a different module (same vendor) to
swap all the 1s and 0s in a string. Now this is a somewhat less trivial
problem than simply swapping two variables, but $str
=~ tr/01/10/;
does the job nicely. Alas, in the same vein as the variable-swap, the method
that vendor went with was:
$str =~ s/0/2/g;
$str =~ s/1/3/g;
$str =~ s/2/1/g;
$str =~ s/3/0/g;
Back to do some more Sections here in the Dist-pen today.
Today I am going to look at three plug-ins the very simple [Extends] the equally simple [MooseExtends] the little different [MooseConsumes]
The first two do what you would expect. Create an 'EXTENDS' section in your POD that lists all the modules that your '.pm' file is based on.
The first one [Extends] loops though the '@isa' and plucks the information from there. Now for kicks I installed this one and added it to my 'weaver.ini' and I got
Here is my latest post about Sparrowdo configuration management tool written in Perl6 -
Sparrow plugins vs ansible modules - an attempt of informal comparison of sparrow and ansible eco systems.
I've been rather quiet lately because between building Tau Station and working with some clients, I'm running around faster than a long-tailed cat in a room full of rocking chairs.
I'll be in Brussels for the February 4/5 2017, FOSDEM, talking about Building the Tau Station Universe in Perl. I was planning on giving a talk about testing, but I was specifically asked if I'd talk about Tau Station. While I love the project, I tried to think of a way it wouldn't sound like a 40 minute infomercial at an open source conference.
Relaxing in a high-tech hotel room in a space station.
So I am finally back to Moose after many many days with Dist::Zilla and Pod::Weaver as to today I am going to see how I can use the Moose::MOP, Dist:Zill and Pod::Weaver all together.
What I am look at today is the [Consumes] section plug-in which is suppose to run out read the meta-classes of my Moose objects and then print out all the Roles that a class consumes. I am not sure what results I will get but is should be fun to see.
So all I need to do is add this in my 'weaver.ini'
I recently
ran across an article (http://neilb.org/2016/08/08/quoted-words-arrayref.html)
by neilb, advocating for a qa() operator that
returns an arrayref instead of a plain array: our
$cars_ref = qa(sedan hatchback coupe);
I love this idea, and I would use it a lot.
I’d like to
add onto this proposal another qw()-style
operator to quote the keys of a membership hash. I suggest qk() for “quote keys.” So our
%is_color = qk(red
blue green);
is the same as our
%is_color = map { $_ => 1 } qw(red blue green);
or our
@colors = qw(red blue green); our
%is_color = map { $_ => 1 } @colors;
Hi! Sparrowdo is a modern configuration management tool written on Perl6. If you wonder how sparrowdo makes a difference you may read this article - Sparrow plugins evolution - an informal introduction to core part of sparrowdo - sparrow plugins.
In my last post I had a look at [Contributors] section plug-in and today I am going to look at not one but three plug-ins
CommentString
CollectWithAutoDoc and
CollectWithIntro
CommentString
This simple plug-in lets you do your own 'Comment' sections like we have seen with [Name] and [Contributors]. It works in much the same way as the [Collect] plug-in, you supply the 'name' for the section and then a 'key' to match on.
For example if I want to have a section for 'Notes' for any comments I may make I could do that by adding this into my 'Weaver.ini' file
Why doesn’t
Perl have a symbolic logical xor operator (spelled “^^”)? As far as I can tell, the only reason
is that C doesn’t have one...
At a minimum,
it would remove the need for parentheses in expressions like $flag =
($subflag1 xor $subflag2);
instead allowing $flag = $subflag1
^^ $subflag2;
…like you can now do with and and or, as long as you spell them “&&” and “||”.
Would I use
this a lot? No. (I would have for maybe the 2nd time yesterday, which is what
made me think of it.) But as someone who loves completeness, the absence of a symbolic
xor absences from
Perl has always bothered me.
Carrying from my last post today I am going to look at the [Contributors] section plug-in. This particular plug-in is of little value so for to my 'Database::Accessor' project as I have no other people working on it with me but one can always dream big that I may have some helpers as time goes on. So it is is work a look.
I wanted to see if anyone else is using this plug-in so I did a Reverse Dependency look up and found that there are thirty-six other distributions that use this so I have few places where I can go an peek and see how it is being used.
Hi ! Sparrowdo is lightweight and very flexible configuration management system written on Perl6. I have started a blog site where going to drop technical notes and others news related sparrowdo project, welcome to https://sparrowdo.wordpress.com !