More API Moose

It still fix API day here in the Moose-pen

Yesterday I left off with a new attribute for may Database::Accessor and DAD, 'da_result_set' and I was just going to play with this in my Driver::DBI but before I go and do this I better change one test a little;

first I had this test near the end of my '20_dad_load.t' test case;

...
    else {
        my $dad = $da_new->result()->error;
        ok($dad->is_ArrayRef ==1,"DAD is_ArrayRef is true")
     }
It of course passes as I am just testing for the default value I should be really test to see if the value is effected by a change. To address this I adding in the following changes

Rewriting B:Deparse and Reintroducing B::DeparseTree

I will be giving a talk on B::DeparseTree and its use in a debugger Devel::Trepan at the upcoming YAPC 2018 in Glasgow. As a result, I have been completely refactoring B::DeparseTree and have a number of thoughts on it and B::Deparse.

Here are some of them. This first part focuses more about B::Deparse and how it could be (or in a sense is) being rewritten. The second part if I get around to writing it will be about the cool features of B::DeparseTree from an application.

Introduction

As someone who make a lot of mistakes, I’ve long wanted to improve the precision of debugging and error reporting. Through Perlmonks, I was directed upon the idea of using the OP address as means to get more detailed information of where the program is. I was also pointed to B::Deparse.

Test Hierarchy Produces Poor Unit Tests

The first part of this series described Test Hierarchy, a hierarchy of test classes that mirrors the classes under test, and explained why it’s an antipattern. For how common it is, this practice doesn’t even produce good unit tests.

New release of Perl::Build

Perl::Build is a Perl Builder created by tokuhirom. You can build and install Perl by:

$ curl -L https://raw.githubusercontent.com/tokuhirom/Perl-Build/master/perl-build | perl - 5.26.2 /opt/perl-5.26/

Also, it is the backend of plenv-install:

$ git clone https://github.com/tokuhirom/Perl-Build.git $(plenv root)/plugins/perl-build
$ plenv install 5.26.2

Recently I became its maintainer, and have released a new version to CPAN. The new version contains the following changes:

Use MetaCPAN API

#66, #67, #73, #74, #75, thanks Grinnz, anttilinno, djzort, sjn.

Now Perl::Build uses fastapi.metacpan.org to find available Perl versions and Perl tarball URLs. MetaCPAN indexer is quite fast. So, as soon as a new Perl is released, you should be able to install it by Perl::Build.

Use HTTP::Tinyish for https support

#72, thanks AnaTofuZ.

Moose Crud May be done but API isn't

Its back to the API day here in the Moose-pen

As my practical tests against a real DB are humming along I noticed that I was missing some-thing quick basic on my API namely retrieving more that just a array-ref of data from the DB. Reading some of my earlier posts I did leave this part to latter so I better do it now before I get too close to my first release.

Now in the present Data::Accessor that Database::Accessor is based off of I noticed that I could pass in an optional $container on the 'retrieve' method and depending on the nature or the 'container' it would handle the results in different ways.

If it was not present that it just did as I do now return and array-ref of results. If a hash-ref was passed in then the the underlying DB would try to do a fetch for each key on the hash and the return an array-ref of hash-refs of the matched keys.

Is language just a set of strings?

The newest entry on my Ocean of Awareness blog: "Is language just a set of strings?"

"The languages human beings use with each other are powerful, varied, flexible and endlessly retargetable. The parsers we use to communicate with computers are restrictive, repetitive in form, difficult to reprogram, and prohibitively hard to retarget. Is this because humans have a preternatural language ability?
"Or is there something wrong with the way we go about talking to computers? How the Theory of Parsing literature defines the term "language" may seem of only pedantic interest. But I will argue that it is a mistake which has everything to do with the limits of modern computer languages."

A new object system for Perl

I just released Dot, it's a new object system for Perl, some of its highlight and difference:
  • There's no code for this object system, you don't even have to install the module to use it.
  • An object is a hash, a method is a closure, and a class is a subroutine.
  • True private variable, not by pretending.
  • Multiple inheritance without the diamond problem.
  • Method dispatching takes zero time, in fact it is not needed at all.
  • The built-in mechanism of Perl 5 OO is completely bypassed.
  • If you want a bird you could inherit from a jungle and remove everything else so that it's the only thing left.
  • You don't need a package to change the inheritance of an object, you only need a single statement.
  • Inheritance of a class could be chosen at runtime, the inheritance of the objects of the same class could thus be different.
  • Easy creation of metaclass, metametaclass, etc.
You can see the full documentation on CPAN .

Perl 6 Training at TPC - Salt Lake City

After TPC join me for The Hitch-Hiker's Guide to Perl 6 at The Little America in Salt Lake City.

Moose Crud all Done?

It still expand Test day here in the Moose-Pen.

Carrying on with my extended 'xt' tests or as I like to call them practical test. I wanted to make sure that I can change the conditions on my Database::Accessor and and check that all the DB is correct in the 'person' table.

To accomplish this I added in the following;

$test_data = $user_db->people_data;
$da->reset_conditions();
$da->add_sort({name=>'id'});
$da->retrieve($dbh);
cmp_deeply( $da->result()->set, $test_data,
            "All Persons result correct");

PAUSE Privacy Policy

Today is GDPR Day, and to celebrate that, the PAUSE admins have added a Privacy Policy to PAUSE. This tells you:

  • what personal data is processed by PAUSE;
  • what PAUSE does with that data;
  • how that data is shared (with the rest of the CPAN ecosystem);
  • PAUSE's lawful basis for holding your information (this is a GDPR term, which essentially answers the question "what gives PAUSE the right to hold your personal data?")
  • what your rights are, and how to exercise them.

The policy is linked off the sidebar in PAUSE, and the source is a markdown document in PAUSE's github repo.

Test::Class Hierarchy Is an Antipattern

Test::Class is particularly good at testing object-oriented code, or so it is said. You can create a hierarchy of test classes that mirrors the hierarchy of classes under test. But this pattern, common in Perl projects, is conspicuously missing from the rest of the xUnit world, and with good reason.

Module Adoption Opportunities! YAY!

Quite some time back I was anxious to find a Perl module or two to work on and gain some experience in the process of releasing modules to the CPAN. Like I'm sure many of you do, I looked through the ADOPTME list to see what looked simple and or fun to work on.

WWW::Shorten and friends came on my radar and I started there. I reached out to the authors of many modules in the WWW::Shorten to see if they wouldn't mind joining me in the effort to bring them all to a similar point. I seem to recall everyone being happy and eager to work together, so this part went well. We created a GitHub organization to house the various modules.

Inevitably, though, I began working on other things and unfortunately have let WWW::Shorten and friends languish. This, however, opens the opportunity for you to take on the task of maintaining a family of modules and bring their test coverage up to date and add in modules for the new shortening services that are available now.

Please let me know if you're interested and I'll happily pass off some commit and PAUSE permissions!

Moose Extends More Tests

Its Just a quick post-ette day here in the Moose-Pen

When we last met our hero she had gotten though most of the perils of the ever-changing API and the ever-increasing code base but found one other problem when working on the test in test case '10_crud_basic.t'

$da = $person->da();
$da->add_condition({
                left => {
                    name => 'user_id',
                },
                right     => { value => $new_person->{user_id }},
                operator  => '=',
            });
$da->retrieve($dbh);

New Dancer trial version released

David Precious has just released a new trial version of Dancer. There are some rather significant changes under the hood, and community testing and feedback is welcomed and encouraged.

Please find us here, Github, Twitter, or on irc.perl.org#dancer with any questions, problems, or feedback.

Thanks! Keep dancing!

Ducktaping The Internet To The Desktop

Simple desktop applications are generally not what one considers a Perl specialization. Its expertise lies in generating processing and transforming textual data, hence its use in the web, and in tools like GUIDeFATE. This 'duct tape' manages to parse text, extracting relevant data, and absorbing information and producing a meaningful output efficiently. Displaying this output in a desktop application shouldn't be too difficult.

Challenge accepted

Building Rakudo.js with JavaScript from the near future

Luckily for us the JavaScript language is constantly evolving towards being a better Perl 6 target (this is a general case of the world in general evolving in this direction).
The next Chrome release will support bigints natively in a matter of days.
Node.js is expected to upgrade the V8 soon too.
The major browsers are expected to follow suite.
Rakudo.js is already ready to use that new functionality.
As part of working on making Rakudo.js run in the browser I'm replacing all the node.js dependent stuff.
For some bignum operations we use a node.js binding to OpenSSL, after the pure js alternatives proved incomplete and/or buggy I have decided that it's not worth to spend the effort towards supporting stuff that will be obsolete soon and use the new features.
My current philosophy towards running on legacy JavaScripts is that with the velocity of the JS ecosystem by the time Rakudo.js is production ready the current once will be widespread.
Obviously if someone needs legacy support he is welcome to work on that (and I'll try my best to help him).

Moose back on Track

Get back on track day here in the Moose-Pen

Well after mulling things over last night I think I will just have to make a note in my API that the 'view' fix will only work for the first layer of 'Link' and I will give a few examples of bets to use this feature and how to avoid problems.

Today I started on practical testing again with the plan being add in a new person/address record and then see if I get the correct values out.

Now to start I created two new Xtest::DA classes 'Address' and 'PeopleAddress' to work with and I instantiate all of these classes using the first record from some tests data I have in utils class;

Bye, bye search.cpan.org

For me, at least, a sad moment. But you can read the details at log.perl.org and make up your own mind.

Perl 6 CaR TPF Grant: Monthly Report (May, 2018)

This document is the May, 2018 progress report for The Perl Foundation's Perl 6 Constant and Rationals Grant.


Tangibles Produced

This month I was working in docs and roast repos, in separate car-grant-midrat branches. So far, they contain 29 documentation commits and 11 spec commits adding about 5,824 words of documentation and 152 tests.

The tests specced the MidRat type. The documentation, along with documenting MidRat/MidRatStr types, centered largely around new Language/Numerics page that describes all of the available Perl 6 numeric types—including native and atomic numerics—their purpose, properties, and hierarchy. This guide was not on the list of deliverables of the Grant and has been produced as a bonus item.

General Info

I started the grant by working on adding the proposed MidRat/MidRatStr type pair. This was the most contentious part of the Rationals Work Proposal that before the grant underwent three revisions, settling on solving the problem by adding the MidRat type.

Swiss Perl Workshop - Announcing Ovid + Call For Papers

We are very happy to announce Curtis "Ovid" Poe as Keynote Speaker for the Swiss Perl Workshop this September in Bern. Join us and learn from his experience as a developer, and maybe also on his journey as a space traveler; take off to Tau Station with Perl!

We encourage you to submit talks and we welcome a broad range of subjects, your talk does not have to be specifically Perl related. Share your experience with others, be it your daily messing around with bugs or rocket science!

We look forward to seeing you in Bern this September.

Great thanks go to our sponsors, who have already commited to the event:

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.