Baby Moose tries again

It a little re-factor days here in the Moose-Pen

So just a quick re-factoring post-ette now that I have the basic CRUD working.

This line of code

my $field = $self->get_element_by_name(sub {$_->name eq $key}); 
was bugging me a little. You really have to have to be a fairly experienced Perl programmer before this type of call is second nature, or you have to be a real fan of List::Util to have this sort of call in you bag of tricks. So I think I will tone the level of this one down a little. This means going back into Database::Accessor yet again and this time I will change only Database::Accessor::Roles::Common by first doing this;

Viewing Your Module Permissions on MetaCPAN

We're currently at the Perl Toolchain Summit in Lyon, working hard on improving MetaCPAN. One feature which we went live with yesterday is a view on CPAN module permissions. This means that you can now easily see which modules any CPAN author has permission to upload.

Read the full post.

Perl Toolchain Summit 2017 - Day 2

My first day at the Perl Toolchain Summit (PTS) was largely spent coding, or dealing with pull requests, tickets, and releasing. The second day had far less of that sort of stuff, and a lot more of the sort of stuff that it's much harder to do away from the summit.

But it started off with a new pull request from Todd Rinaldo resurrecting a closed RT ticket. There is a whole class of problems Devel::Cover has to deal with which stem from the program being exercised changing the environment as it runs. The most obvious, perhaps, is changing directory, which is also something I looked at again yesterday. But this time it has to do with dropping permissions during the run. Todd and I had a discussion about it and, with the principles in place we'll deal with the technical matters in the coming days.

I can't install perl-5.26.0-RC1 in CentOS 5.11

I try new perl in Cent OS 5.

But I can't install perl-5.26.0-RC1 in CentOS 5.11.

sv.c:(.text+0xe11): undefined reference to `Perl_fp_class_denorm'

Maybe this is similar with the following ticket.

https://www.nntp.perl.org/group/perl.perl5.porters/2016/09/msg239982.html

More information

Baby Moose All Tuckered out

It if put the 'D' in CRUD day here at the Moose-pen.

So yeaterday I fininsed off Retreive/Select after I pulled a few hairs out trying to debug and issues that was not there I thouhg today I wiyld finish of my CRUD subs by doing the _delete sub today.

At least this is the most simple of all four functions as there is not need to iterate over fields or contrainers so the code is just;

The Toolchain Summit is only possible with support from our sponsors

The Perl Toolchain Summit (PTS) started yesterday (Thursday 11th May) in Lyon, France. 35 dedicated toolchain developers have assembled for four days of intensive discussions and co-working. Not only does a lot get done in these four days, but we send everyone home with longer todo lists, fired up to keep working on them.

The developers come from around the world, and we're only available to do this with the generous support of all of our sponsors. You've seen individual posts for our Platinum and Gold sponsors, but in this post we'd like to tell you about our other sponsors. If you get the chance, please thank them: all Perl developers benefit from this summit.

Turning Hooks off in App::GitHooks

CPAN Pull Request Challenge selected App::GitHooks for me in February. As usually, I started by browsing the issues, and my attention was drawn to Tim Bunce’s request to add a way to skip given hooks.

Converting glob patterns to efficient regexes in Perl and JavaScript

In Glob Matching Can Be Simple And Fast Too Russ Cox benchmarked several glob implementations by matching the string a100 against the pattern (a*)nb. (Here exponentiation refers to string repetition, as in 'a' x 100 matched against ('a*' x $n) . 'b' in Perl syntax.) What he found was that some implementations returned results instantly whereas others got extremely slow as soon as n grew past 5, taking seconds, minutes and even hours to finish.

This problem is caused by excessive backtracking. It's possible to implement globbing without nested backtracking (and the linked article explains a simple algorithm to do so), but a naive recursive implementation will suffer from this issue. It affects some shells, FTP servers, and programming languages, including Perl: File::Glob uses code from BSD libc (which is affected, unlike glibc). A patch was written and the next File::Glob release will include a fixed algorithm.

Baby Moose Selection

Well if carry on as if you are normal day here in the Moose-pen

In yesterday's post I manged to get the update sub working with a real DB and today I am going to try the 'retrieve' sub which is a little more tricky.

The basic concept is much the same as for the other two and it really did not take me long to get it up and working, the only real gaff was this one

Subroutine _select redefined at 
as I had a stubbed in version that I simply got rid of. Apart from that and the sact one does not spell alias as alais things when together quickly and here is what I have;

Ref::Util updates: Pure-Perl now available!

During our first day at the Perl Toolchain Summit (PTS-2017), Aaron Crane and I just released Ref::Util 0.200 and Ref::Util::XS, which constitute the next planned major release of Ref::Util. Yup, it now has Pure-Perl and optional XS. Read on.

Perl Toolchain Summit 2017 - Day 1

This year the Perl QA Hackathon has been rebranded as the Perl Toolchain Summit on the advice of the marketing team. This is the tenth year that the event has been held and, after missing the first few due to scheduling conflicts with my (then young) children's birthdays, I suppose I have now become something of a regular. This year the event is being held in sunny^W rainy Lyon - a shortish train and car (thanks Lee) ride for me.

The Perl Toolchain Summit (hereafter PTS) has become the most important Perl event of the year for me. It's a chance to get together in one room (two actually) as many of the people as possible who work on the Perl infrastructure. This is not the perl core, but the entire toolchain that fits around the core - primarily focussed on CPAN, the archive of Perl modules. CPAN was one of the first such archives, and the infrastructure around it - especially with regard to CPAN Testers and the MetaCPAN architecture, is generally regarded as without peer.

Specifying dependencies for your CPAN distribution

In this article I'm going to show you how to specify dependencies for your CPAN distributions: the other Perl and CPAN modules that your distribution relies on. This is the fourth article in a series. The first article gave a general introduction to distribution metadata. The second article introduced the five phases for which dependencies, or prerequisites, can be specified. The third article presented the types, or relationships, that can be specified for each dependency.

This article is brought to you by cPanel, Inc., a Gold sponsor for the Perl Toolchain Summit. cPanel are a well-known user and supporter of Perl, and we're very grateful for their support. More about cPanel at the end of this article.

Baby Moose Update

Its get more done day here in the Moose-Pen

Now that I have got 'create/insert' to work in yesterday's post I think I will move on down the line and get the next one easy one to work 'update'.

This first thing though is to get rig of this waring;

Commit ineffective while AutoCommit is on-1 at D:\GitHub\database-accessor-driver-dbi\lib/Database/Accessor/Driver/DBI.pm line 64
ok 1 - Create function
nothing major really the waring is perfectly harmless but I could see some people getting annoyed at that and the fix is simple, if the DBI 'AutoCommit' flag is set don't try and commit. So here is that change;

$dbh->commit()
 --          unless($self->da_no_effect);
++         if ($dbh->{AutoCommit} == 0 and !$self->da_no_effect);

Virtual Spring Cleaning - in which wild modules ambush me

In April, Google announced that Google Chrome was finally supporting headless mode, at least on Linux and Mac OS. Back then, I noted to myself that this might be a good time to revisit my rough prototype of WWW::Mechanize::Chrome. According to Git, I had written a first prototype of it in 2010 which used the old, raw socket protocol. But time has progressed and the protocol now uses Websockets. My original approach used AnyEvent, so I quickly replaced my own approach using AnyEvent::WebSocket::Client, and the HTTP parts with Future::HTTP.

Perl 5 Porters Mailing List Summary: April 27th - May 8th

Hey everyone,

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

Enjoy!

\d does not validate numbers

http://stackoverflow.com/questions/43814055/easy-to-check-if-user-input-is-a-number-in-perl

points us to this Perl FAQ:

http://perldoc.perl.org/perlfaq4.html#How-do-I-determine-whether-a-scalar-is-a-number%2fwhole%2finteger%2ffloat%3f

Unfortunately, the regular expression part of the above FAQ page is wrong. \d doesn't validate numbers, unless you have already verified that your input contains only ASCII characters.

What \d does is to validate whether a number is regarded as a numeral in Unicode. For example, \d will happily match things like U+07C2: '߂' NKO DIGIT TWO, or 096F: '९' DEVANAGARI DIGIT NINE, and 360 other characters which are not valid as numerals. If you need to use a regular expression to validate whether something is a number, use [0-9] to match digits, not \d.

The reason I'm aware of these defects in the use of \d for validating numbers is because of having used it to validate user input at the following web pages:

Baby Moose About to Stand

Its actually do something day here in the Moose-Pen

So yesterday I left off with my Driver::DBI generating this SQL code;

INSERT INTO user (address,username) VALUES(?,?) 
now I actually have to get that to run against a DB. I have the first DBI part done the prepare and it works

Perl short string implementation is interesting

Perl short string implementation is interesting.

add SHORT PVs

This decrease memory accesses when string is short in 16-bit.

Type::Tiny 1.2 Coming Soon

Or 1.002000, because it uses Moo-like versioning.

The Type::Tiny 1.1 (1.001_00x) development cycle has been going on since September 2014. Apparently I'm either very concerned about stability or very lazy. You can make up your own minds about that.

But Type::Tiny 1.2 should be released in a few weeks. If your application uses Type::Tiny, you may want to download the latest development release and check that nothing breaks. (It shouldn't, but you never know until you try.)

The headline changes are:

  • Type::Params now has compile_named and validate_named.
  • Type::Tiny's constraint parameter may be a string of code.
  • Fixed bug where Types::Standard::Int would sometimes accept an overloaded object. (It never should.)
  • Various performance enhancements and bug fixes.

I'll explain the first two in more detail, because they're interesting.

Perl in a Business Application

Perl in a Business Application - Musings of an Architect

Everybody knows that Perl is not the right language for a large scale enterprise application. This is common knowledge, right? But why is that? Explanations are as many as there are people explaining. Everything from "it's a script language, therefore slow" to "its free syntax breeds discoherence" to "Perl developers are horrible individualists".

Well, I didn't believe this, and I went on to help in a startup which wants to build some fintech systems, the first aim of which is to integrate with Finnish banks and collect daily payments from a customer's bank account.

It was decided to use Perl as the core language. If Perl is (was) good enough for Goldman Sachs and Morgan Stanley it surely is good enough for us. So off to build a framework!

Two Failed Attempts for System Architecture

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.