It carry on testing developing day here in the Moose-Pen.
I left off yesterday with a new Test::Utils->sql_param_ok sub that is going to save a good deal of coding effort as I move forward once I get all the tests up to the new standard of curse, (one foot forward one and a half steps back)
Today I am going to carry on with alias testing this time I am checking basic field alias. To accomplish this I changed the 'elements' in my $in_hash to ones with field aliases;
The other day I ran across a pattern in our codebase at $work, and I was mightily impressed. It solved a problem I had run into before, but the solution here was much more elegant than mine, so I’m officially stealing it. And sharing it with you.
The problem that we’re looking at today is building Moose attributes. Now, in and of itself, there’s nothing exciting going on there. Perhaps we might have an attribute whose value comes out of a config file, so we might build it like so:
There's an open issue on the vim-perl issue tracker about how the current syntax highlighting is inconsistent in how it highlights chained method calls, which currently looks like this:
In a recent post I mentioned that I went out and read though a number of SQL syntax books to make sure I was doing things correctly in which SQL clauses (Where, Sort, Link) goes where. That go me to thinking was the system I was using to test the SQL on a real DB using standard SQL?
Normally I test with Oracle App Express as it work well on a Windows box and has a nice UI but I just noticed that I have some odd SQL in one of my test cases 15_alias.t;
When I first joined the Rakudo project, we used to say "there are none right now; check back in a year" whenever someone asked for a book about the language. Today,
there's a whole website for
picking out a book, and the number of available books seems to multiply every time I look at it.
Still, I feel something is amiss, when I talk to folks on our support
chat, when I read blog posts about the
language, or when I look at our official language documentation. And it's due to that feeling that I wish to join the
Rakudo book-writing club and write a few of my own. I dub it: The Rakudo Book
Project.
The Books
The Rakudo Book Project involves 3 main books—The White Book, The Gray Book, and The Black
Book—as well as 2 half-books—The Green Book and The Cracked Book.
As part of porting GraphQL to Perl (sponsored by Perl Careers), one of my goals is to use the best possible practice in making rigorous code. One way to use this is to imitate the style of the JavaScript reference implementation's use of immutable data structures.
One problem arising is creating objects that have a reference to themselves. If the objects created were mutable, then one would simply create the object, then set the relevant attribute to include the object reference. If the objects are immutable this is not possible. For example:
As a proof-of-concept, Importer::Zim has been released to CPAN. For modules
which export symbols and define @EXPORT, @EXPORT_OK and
@EXPORT_TAGS, zim can be used as a pragma to import subroutines
into the caller package with lexical scope for perl 5.18+.
use zim 'Scalar::Util' => qw(blessed);
use zim 'List::Util' => qw(first sum max any all);
use zim 'Fcntl' => ':flock';
use zim 'Carp'; # imports carp(), confess(), croak()
use zim 'Mango' => 'bson_time' => { -as => 'bson_dt' };
for testing parentheses. I figured I might as well re-use that little snippet of code else where as it is valid SQL anywhere you would use a 'field'.
One very odd place to use it would be in a sort if you want to order a list by how much over time and double time a person earned. So I added a new test to my '60_order_by.t' case;
The London Perl Workshop (LPW) takes place this year on Saturday 25th Nov and you are encouraged to submit your talk proposals now (or if you have already, feel free to submit another!).
The informal theme this year is "Perl and friends". We welcome proposals relating to Perl 5, Perl 6, other languages, and supporting technologies.
If there would be an election for the single greatest Perl 6 feature, many would select the box for grammars and others would root for concurrency/async (as expressed in several articles here and elsewhere). Roles and types might be also strong contenders. Here is why I would pick: none of the above, even I like all of them very much.
Today I am re-writing the '47_dynamic_gathers.t' test. Looking at the code I cannot really use any of it as my Gather concept moved from two array-refs (gathers,filters) to just a singleton of 'Gather' made up of, elements and condtions.
The test is a little simpler now as all I have to test for is when I add a 'gather' the 'elements' and 'conditions' are correctly passed down from the DA to the DAD and when I add another 'gather' the current one is overridden by the new one;
A bit overdue post, but I attended this months's Perl 6 Community Bug Squashathon last weekend and it was fun! I had a great time learning some more Perl 6 while making contributions at the same time. Definitely looking forward to next month's!
Here are a few little bits of Things I've Learned...
After explaining the kinds of prototypes that are used in complete Programming and the way code moves between them, it is time the explain the other motivation behind this concepts, before we see the big picture (project planning) next time.
I am pleased to announce that Enlightened Perl Organisation (EPO) has kindly extended the support of Strawberry Perl project by sponsoring our build server for another 12 months. I would like to thank Mark Keating for arranging the funding.
If you are also considering supporting Strawberry Perl project you can do it indirectly by becoming EPO member or via donating EPO.
Well it tests everything again day here in the Moose-Pen
Is been almost two weeks since I started mucking about with Accessor.pm again trying to get my inherited views, parentheses, and conditions all in a row before I pass them down to the DA and now that I have things I think all settled I it time again fro me got go back and re-run the test suite to see if I did not bugger too much up.
https://metacpan.org/pod/Data::Edit::Xml provides a Perl centric means of editing data held in Xml format. Thus:
my $a = Data::Edit::Xml::new("
");
say STDERR -p $a;
gives:
To cut out
c
under
b
but not under
d
:
$a x= sub {--$_ if $_ <= [qw(c b a)]};
say STDERR -p $a;
gives:
I had the honor to give a talk at Barcelona.pm Meetup. Perl community rocks as everybody knows; my new friends welcomed me and my family. We felt home, learned new things, enjoyed the nice dinner and it became the most memorable night in Barcelona.