Well it clean-up and re-factor day in the Moose-pen. So no new Moose Majick today just cleaning up and adding in stuff that I have left out (forgotten actually) and moving things about.
Well the first thing I did was finish off the last three of my remaining Accessor attibutes, 'gathers', 'filters' and 'sort' or if you are SQL inclined 'group by', 'having'. and 'sorts'.
The 'gathers' and 'sorts' attributes are just a pair of 'ArrayRefofElements' which I covered off in this post and types and the 'filters' is a 'ArrayRefofConditions' which I covered in this post. I did of course spend a little time making sure that my DAD role attributes matched up with the accessosr ones and as this is me programming I created two new test cases, 37_gathers.t that handles filters as well, and 39_sorts.t
We recently came across Pegex and found it to be an interesting module for parsing text data. Instead of using regular expressions directly, the user can write a grammar for the data to be parsed. The data can be automatically converted to a native Perl object or, if the user desires, it's possible to use actions to handle the grammar while parsing using a Pegex::Receiver class.
Pegex uses the type of grammars called Parsing Expression Grammars (PEG), which is an unambiguous form of writing a grammar. Each parsed string will in effect have a single valid parse tree. Since Pegex converts the rules of the grammar to regular expressions, it is a greedy parser.
In this blog post we demonstrate how to easily use Pegex to parse an /etc/hosts file on Linux and convert the result into Perl objects automatically without having to manually create any object.
For more details check out the original blog post by me here.
Since the Perl Magazine sadly had to close i didn't wrote as many Perl articles anymore. Because I miss it sometimes I recently agreed to write for DZone. Its a Java- centric site with many light weight pieces. I read it myself, since you can find interesting stuff here and there.
But why I'm writing this here? In order to publish, it has to be transported from your blog. And since I don't own another blog and the Perl 6, Perl 5 and software engineering stuff I want to write about fits here nicely : I will use this blog as transport. for that purpose. So please don't wonder if some of my next text are here sound like I assume you never heard about Perl. If the entry is marked with the category DZone you know why.
But there is also another reason why I use this Blog. Since I will be a kind of press secretary for Perl in that area, I actually want to be controlled and corrected by you and also encourage you to engage in the discussions below these articles on DZone (link will be provided in comments), to make Perl more visible to outside world.
So today in the Moose-pen I am going to move onto something a little differtn and that is my Accessor 'links' attribute which I am going to cover with the 35_links.t test suite.
I did a quick review of the bits and pieces I had stubbed in so far and I notices I need a few thing. First had a look at my Accessor 'links' attribute and I will need a new type for that. So to get this new 'ArrayRefofLinks' type I just did what we have seen in a number of older posts, namely add in a 'use', a 'class_type' and a 'subtype' into my Types.pm, I will hold off on a coercion for now till I get a little deeper into my post. So that takes case of 'links'.
I also noticed that 'Links' attribute of my DAD now had the wrong type as well so that was change to the 'ArrayRefofLinks' type
Looking at my 'Database::Accessor::Link' class I have never liked this two attributes
While testing a fix for one of the Less Than Awesome behaviours in standalone
Signature objects, I came across
a bugglet. Smartmatching two Signatures throws, while spilling a bit of the
guts:
<Zoffix> m: my $m = method ($a: $b) { }; say $m.signature ~~ :($a, $b);
<camelia> rakudo-moar 46838d: OUTPUT«Method 'type' not found
for invocant of class 'Any' in block at line 1»
So I figured I'll write about fixing it, 'cause hacking on internals is lots of
fun. Let's roll!
Golf It Down
The less code there is to reproduces the bug, the fewer places there are
for that bug to hide. We have a detached method and then we smartmatch
its signature against something else. Let's try to golf it down a bit
and smartmatch two Signatures, without involving a method:
Today in the Moose-pen I am going to play with the very familiar 33_condtions.t and this time I am going to solve another little API problem I know I am going to run into.
Part of my evil plan is to allow end users to add in conditions on the fly and I have made provision for that with the 'rw' 'conditions' attribute found on my DAD Role. Now I have to fix a minor oversight on my part can change the type on 'conditions' to be the same as the original in Accessors, so I changed this
– isa => 'ArrayRefofPredicates',
++ isa => 'ArrayRefofConditions',
What I want to be able to do is allow my end users to do something like this
Well in today's Moose-pen I am still going to play about with good old
33_condtions.t
, not the tests per-say but the API they are calling. In my last post I fixed the my API call by adding in the 'predicates' param to the 'conditions' param like this
I've started a new series on my testing blog about the differences between Perl, Python, and Ruby's testing ecosystems and architectures. First article looking at the most basic assertions is done:
So in my last Moose-pen I ran into problem with my 33_conditions.t test case where it was giving me errors like this
# Compared $data->left
# got : Does not exist
…
Well after some playing about I saw the errors of my ways. Looking at the Database::Accessor::Condition class I remembered to load that properly I will have to pass in any conditions with the 'predicates' param. So I modified my$$in_hash to this;
I wrote my first Perl 6 program—a New Years IRC Party bot—around Christmas,
2015. The work included releasing the IRC::Client
module, and given my
virginity with the language and blood alcohol level appropriate for the Holiday
Season, the module ended up sufficiently craptastic.
Recently, I needed a tool for some Perl 6 bug queue work, so I decided to lock
myself up for a weekend and re-design and re-write the module from scratch.
Multiple people bugged me to do so over the past months, so I figured I'd also
write a tutorial for how to use the module—as an apology for being a master
procrastinator. And should IRC be of no interest to you, I hope the tutorial
will prove useful as a general example of async, non-blocking interfaces
in Perl 6.
Dancer 2 0.201000 is on its way to a CPAN mirror near you.
The Dancer Core Developers are sad to announce the retirement of David Golden (xdg) from the core team. Dancer2 was made much better by his many contributions, and we are extremely grateful for all he has done.
We’d also like to announce the addition of Peter Mottram (SysPete) to the core team. SysPete has been working quietly behind the scenes on a number of projects, but has been a valuable member of the core team for some time now, and we are happy to have him aboard.
The core developers would most importantly like to give thanks to our awesome community for the numerous contributions towards this release. You rock!
Currently the focus of the work on the js backend is on making nqp-js emit code that runs at a reasonable speed (so that compiling Rakudo and its setting doesn't take eons and I can iterate on it more easily).
Being able to easily profile nqp-js code is very useful for that.
The js profilers I have tried didn't work out so well
devtools had trouble with native modules as it runs in
running directly inside chrome require webpacking
node-inspector didn't support console.profile/console.profileEnd and it's interface locked up while profiling