Matureing Baby Moose

Its re-factor test postette day in the Moose-Pen

Over the past few days I have made up quite a few tests and they where all the same pattern

  • Base hash
  • add function/expression element
  • create DA
  • run select/retrieve
  • check SQL
  • check parms
so a little re-factoring is in order me thinks., Though there is a school of thought that it is a waste of resources to re-factor working test. Fortunately I do not ascribe to that thought so here we go. The re-factoring was quite simple, I took my test;

New blog post: Using a DarkPAN with Carton

Read all about it here: http://domm.plix.at/perl/2017_07_carton_darkpan.html !

Dancer2 0.205001 improves documentation and internals

The Dancer Core team has just released Dancer2 0.205001. This release primarily fixes some documentation issues with a couple of notable exceptions:

  • If HTTP::XSCookies is installed, Dancer2 will check at install time to see if the correct version is installed (Peter Mottram)

  • Dancer2 is now tested by Travis CI on Perl versions 5.22, 5.24, and 5.26, as well as Appveyor (Dave Jacoby)

  • All reference checking under the hood is handled by Ref::Util (Mickey Nasriachi)

We have several new contributors this release. Thanks to Dave Jacoby, Abdullah Diab, Glenn Fowler, and Jonathan Cast for your first patches to Dancer2!

The full changelog follows:

Perl 5 Porters Mailing List Summary: July 3rd-9th

Hey everyone,

Following is the p5p (Perl 5 Porters) mailing list summary for the past week.

Enjoy!

Baby Fancy Moose

Its get fancy day here in the Moose-Pen

Now that I have 'Functions' nicely working I am going to move on to the next logical field and that is an 'Expression'. In SQL (and 99.9% of other languages) an expression is just a predicate that can be evaluated. So an SQL like this

SELECT user.username, user.salary + 10 FROM users WHERE username='BOB'
In Database::Accessor I have an Expression class for this and it works 90% the same as the Function class I just finished. Thus this expression;

user.salary + 10
is expressed as the following attributes

Always use `const char *` to refer to the return value from SvPV

Always use const char * to refer to the return value from SvPV.

Yesterday I got a bug report from a user via Github about Text::Fuzzy.

The bug report described that in some cases, when the user searched for an edit distance with Unicode strings, the user's input value, $string in the following, seemed to be being overwritten and corrupted:

$tf->distance ($string);

I couldn't reproduce the user's bug using the script he supplied, but just in case, I went through the code and tried to find anywhere that a string might be being overwritten, by adding const in front of every char * pointer which was used to store a Perl string.

This led me to this line where the value corresponding to $string in the above is read using SvPV, and this line where the value pointed to is overwritten by the code. This is a special case which only executes when the user matches a byte string against a character string.

Using a controllerless servo on the Raspberry Pi with Perl

I put out a notice not long ago that I was contemplating writing a guide to using the Raspberry PI with Perl.

One person who pointed out one minor mistake of mine with follow up with some other questions, asked about how to run a servo without needing a controller board. I realized that I hadn't exposed a couple of functions in the core WiringPi::API distribution that allowed a user to configure the PWM frequency, which is required as the Pi default doesn't play nice with typical servos.

The default PWM base frequency on a Pi is 19.2MHz, which is then divided by the clock signal (default: 32) and the PWM range (0-1023). So to get the default operating frequency:

# base   range   clck     operational freq
19.2e6 / 1024  /  32   ==     586Hz

The Hot New Language Named Rakudo

This article represents my own thoughts on the matter alone and is not an official statement on behalf of the Rakudo team or, perhaps, is not even representative of the majority opinion.


When I came to Perl 6 around its first stable Christmas 2015 release, "The Name Issue" was in hot debate. Put simply: Perl 6 is not a replacement to Perl; Perl 6 is not the "next" Perl; Perl 6 is a very different language to Perl; so why does it still have 'Perl' in its name?

From what I understand, the debate raged on for years prior to my arrival, so the topic always felt taboo to talk about, because it always ended up in a heated discussion, without a solution at end. However, we do need that solution.

Baby Moose Recursion Dance

It carry on with recursion day here in the Moose-Pen

Carrying on from where I left off in yesterday's post I was about to add in this new test;

__END__

Browsing the puny (I miss Borders!) Technology section at the local Barnes & Noble today, I did not see a single Perl book. I was hoping that they sold out, but the manager confirmed my fears: they no longer carry Perl books in that store. The reason, he said, is that no Perl book has been published since 2012.

In regard to the size of the Technology section: The way the shelves are stocked is based on sales. Since people rarely buy their technology books from the store (guilty...), the Technology section is correspondingly small. "The people who are interested in these books read them in the Cafe, but they never buy them."

The not-so-great escape

Escaping HTML is the process of converting a user's input into something which can be displayed back to the user in a web browser. For example, in a comment section on a blog, or a wiki editable by users.

Given user input such as <script>, to display that correctly, an HTML
escaper must output &lt;script&gt;. This is then converted into
<script> rather than an actual HTML script tag by the browser:

s/</&lt;/g;
s/>/&gt;/g;

But supposing the user inputs &lt;script&gt;, what should be done with it?

If the &lt;script&gt; is not altered by the HTML escaper, then when it is displayed back to the user, it gets converted by the browser back into <script>, which is not what was intended, and even worse if the user tries to edit the comment again, the HTML tag may get removed from the text.

The solution to this problem is to also convert the ampersand, &, into an HTML entity, like this:

s/&/&amp;/g;

CPAN Testers Has an API

[Watch this lightning talk on The Perl Conference YouTube channel]

I've been working on the CPAN Testers project since 2015. In all that time, I've been focused on maintenance (which has involved more operations/administration tasks than any actual code changes) and modernization. It's that modernization effort that has led to a new CPAN Testers API.

This new API uses the Mojolicious web framework, along with an OpenAPI schema to expose all of the most useful CPAN Testers data. OpenAPI is a specification for web APIs, and there are tools like Swagger to generate a useful documentation website from your spec, like the CPAN Testers API documentation website.

Ambitious Baby Moose

Its get back into Driver::DBI day today here in the Moose-Pen

I decided to get a little more ambitious and see it I can get Driver::DBI to handle a function call in an SQL select, like this;

SELECT user.username, 
             left(user.username,11), 
             user.address 
FROM user 
WHERE user.username = 'Bill'
The way I have planned to do this is Database::Accessor with the 'Function' class, which has a simple string attribute for the function name and it is used with 'Comparator' role attributes. Thus I can break

left(user.username,11)

Perl 5 Porters Mailing List Summary: June 29th - July 2nd

Edit: 5.24.2-RC1 and 5.22.4-RC1.

Hey everyone,

Following is the p5p (Perl 5 Porters) mailing list summary for the past half a week.

Enjoy!

Perl 6: Seqs, Drugs, And Rock'n'Roll (Part 2)

Read this article on Perl6.Party

This is the second part in the series! Be sure you read Part I first where we discuss what Seqs are and how to .cache them.

Today, we'll take the Seq apart and see what's up in it; what drives it; and how to make it do exactly what we want.

PART II: That Iterated Quickly

The main piece that makes a Seq do its thing is an object that does the Iterator role. It's this object that knows how to generate the next value, whenever we try to pull a value from a Seq, or push all of its values somewhere, or simply discard all of the remaining values.

Perl DBI and INTERVAL values

I was having trouble using DBI to bind an interval value. Wonder if anyone has a better solution than this:

http://openbedrock.blogspot.com/2017/06/binding-parameters-for-oracle-interval.html

i could not find any information about binding an Oracle INTERVAL LITERAL. Maybe I just missed it in the docs?

Baby Moose Clean Up

It is test catch up day here in the Moose-pen.

I figured it is a good thing to review the state of the test suites for both Database::Accessor and Driver::DBI and starting with Accessor.pm I get this;

Perl 5 Porters Mailing List Summary: June 20th-28th

Hey everyone,

Following is the p5p (Perl 5 Porters) mailing list summary for the past week and a half.

Enjoy!

List your dist's prereqs where newer versions have become available

I've got quite a few CPAN distributions that require one another, and it's gotten to the point that it's very easy to forget to bump prereq versions before uploading a new release to the CPAN.

As a stopgap, I wrote Module::CheckDep::Version (may not be indexed yet). What this module does is using MetaCPAN::Client, fetches all distributions by author, pulls out all prerequisite distributions and the version of it that your distribution has listed, checks if there's a newer version of it, and lists out the ones that need a bump in the prereq's version.

Update: I've updated the distribution (v0.05) to install a binary, checkdep, so that you don't have to write your own to use the library:

A Date with CPAN, Update #2: A Little Piece of Date::Piece

[This is an addendum post to a series.  You may want to begin at the beginning.  The last update was update #1.

IMPORTANT NOTE!  When I provide you links to code on GitHub, I’m giving you links to particular commits.  This allows me to show you the code as it was at the time the blog post was written and insures that the code references will make sense in the context of this post.  Just be aware that the latest version of the code may be very different.]


This year is only the second time since 2011 that I’ve been unable to attend YAPC::NA.  Since I couldn’t make it out to hang with my Perl peeps in person, I thought the least I could do is offer up a long-awaited update to Date::Easy.

This latest version (available now-ish on CPAN as 0.03_01, and to be upgraded to 0.04 within the next few days assuming CPAN Testers approves) contains a few small updates, and one big one.  First, the miscellaneous bits:

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.