Moose Loose Ends Part the Third

Its pull hair day here in the Moose-Pen

Yesterday I merrily finished off all the changes where I swapped out die for confess and the changes where I updated the error messages to the same standard. I then happily check in Accessor.pm and was looking forward to a quick testing post for today. happily finished and checked the lot in. Then tried to run my test suite an got;

t/00_load.t ................. 1/1
#   Failed test 'use Database::Accessor;'
#   at t/00_load.t line 7.
#     Tried to use 'Database::Accessor'.
#     Error:  syntax error at /home/scolesj/database-accessor/lib/Database/Accessor.pm line 627, near "if"
# syntax error at /home/scolesj/database-accessor/lib/Database/Accessor.pm line 718, near "if"
opps obviously I did not run any tests before I checked in and pushed my code to github.

"Measuring language popularity"

Measures of language popularity are more than a little rough. Can they be improved? My latest blog post is "Measuring language popularity".

Perl6::Math::Matrix (Part 4: naming methods)

While reflecting on how to write a good Perl 6 module, I thought a lot about how to properly name my methods. In this text I want to summarize what served me, which is a direct continuation of the last part, where I wrote about when it is helpful that methods share one name.

Programming the Raspberry Pi with Perl: eBook Released!

It's finally here! Our Programming the Raspberry Pi eBook has been released!

You can learn more about it and purchase it here on Leanpub.

As one person mentioned to me "Finally, a release from the shackles of Raspbian and Python!".

Timm and I want to thank all of the financial contributors who got this project off the ground!

Moose Loose Ends Part the Second

Still error day here in the Moose Pen.

As I am a little lazy today and I didn't have time to work on this project last night, there was a Godzilla film festival on last night, it just a quick postette today.

I went though all the Database::Accessor code today and cleaned up at least the format of my die calls.

Looking about at a number of other applications I figure I might as well go with the semi-standard CME or 'Class', 'Method', 'Error' style.

Lets take this first example the Die that one could run into and that is found in the BUILD sub of Database::Accessor when it call out to the '_loadDADClassesFromDir' sub;

opendir( DIR, $path ) or die "Unable to open $path: $!"; 
Not one of my better error messages so I changed it over to;

Hacktoberfest Challenge 2018

The Hacktoberfest Challenge 2018 is on and it is my fourth attempt. As always, I am very excited about the event.

September 2018 has been very special month so far for me. Why? In this very month, I submitted my 1000th Pull Request. Also as of today 1st Oct 2018, I have completed 407th days of daily upload to CPAN. My next target is reach 500 days mark, which I am hoping to reach by new year. I also submitted my talk proposal to London Perl Workshop 2018. The title of my proposed talk is "The power of mentoring". For a change, I have also submitted proposal for lightning talk "What after the Pull Request Challenge?". If you haven't submitted your talk proposal yet, then please do so now. I would like to
share one sweet moment with everyone. After submitting my 1000th PR, the first PR that got merged after that had the following message for me.



Lets go through the rituals now.

YAML::PP ♥ libyaml

I wrote two new modules, combining YAML::PP and libyaml: YAML::LibYAML::API and YAML::PP::LibYAML

Think globally, act local-ly

Here’s a pattern which took me a while to figure out this past week, and therefore seemed worthy of sharing with you guys.

First, let’s set the situation.  (These are certainly not the only conditions under which you could use this pattern, but it’ll probably be easier to grasp it with a concrete example.)  Let’s say you have a script which you’re going to use to launch your other Perl scripts.  This script (in my example, it’s a bash script, but it could also be a super-minimal Perl script) has exactly one job: set up the Perl environment for all your personal or company modules.  That may even include pointing your $PATH at a different Perl (e.g. one installed via perlbrew or plenv) so you’re not reliant on the system Perl.  Here’s a typical example of what such a (bash) script might look like:

Moose Loose Ends Part the First

Its error day here in the Moose Pen

Well not really error day more like lets have a look at the errors I spit out and attempt to standardize them, but that is too long for a catch title.

First thing to do was have a look at how my Accessor.pm and from a review I see that I only use 'die'. I found it in about 22 spots in the code. The good thing is I don;t have a mixture of croak, die and croak
carp and confess. The bad thing is I wad never very consistent with my die messages;

Most are just simple strings such as

Attempt to use create with no_create flag on!
The \$container Hash-Ref cannot be empty
Some are a little more informative;

1000+ Pull Requests: What kept me going?

I have been asked this question many times since I submitted over 1000 PR. Before I answer this question, I would like to share a secret with you all.

It all started in the month of Jan 2015 with Pull Request Challenge (PRC) pioneered by Neil Bowers. Although I was already submitting PR before that but without any target. With PRC, I got direction where to go. I must admit taking on PRC wasn't easy one. I didn't want to make a fool of myself by joining PRC and not submitting PR regularly. I still remember first couple of months, so many Perl hackers joining the PRC but not every one actually submit PR regularly. Some even dropped after a while. But I kept it going as I was enjoying it. Although I was hardly getting any acknowledgement from the distribution author. It can be discouraging for the beginners.

Rakudo.js update - running Perl 6 in the browser with Parcel

Rakudo.js i n combination with parcel.js now supports running simple stuff in the browser. See https://github.com/perl6/perl6-parcel-example for an example of running a simple test.

It's not super usable and this moment and will likely explode if you try to have too much fun.
Hopefully this example will be replaced by something much more awesome soon.

Parcel.js is a web application bundler so it will take care of combining the JavaScript code Rakudo.js spits out with everything else your app needs to run.

Why Parcel.js instead of Webpack?
Mostly because Parcel while seemingly more buggy doesn't insist that hard on re-parsing the generated code.
I had a webpack plugin working for NQP at some point so it definitely is doable so webpack afficionados are welcome to contribute a plugin or entice me to write one.

Currently I'm using some cutting edge JS features (like BigInt) so I'm focusing on supporting Chrome.
I plan to spend some time on supporting other common browsers when Rakudo.js is more mature but luckily the evergreen browsers are constantly updating themselves and implementing new stuff so hopefully the problem will solve itself.

Dist::Zilla Starter revision 3 - Git, versioning, and more

I've just released revision 3 of the @Starter plugin bundle for the Dist::Zilla CPAN distribution authoring tool. There's no changes to the base configuration from revision 2, but there are now additional options to help manage common authoring tasks using modern best practices. You must set your revision to 3 to enable these new options, as a safety measure to make sure you have a new enough version of the bundle to support them.

Worried Moose

Its re-think things day here in the Moose-Pen

It seems I am getting close to finishing off Database::Accessor and Driver::DBI. I have a very complete test suite for both and an extensive practical test suite for Driver::DBI and all three are running at 100% pass. I should be happy.

Well I am not. The practical testing did show me one major API change that I should make.

If one of the main advantages of Database::Accessor is that it can protect the data in your DB from injection attacks and from backdoor queries that can find things out about your Data or even change it.

It is serves to reason that anyone who is going to try and do this sort of malfeasance at the code level really wouldn't bother to use Datadate::Accessor. Given that the calling format for Database::Accessor is;

$da->retrieve($db_connection);

Sydney Perl Tomorrow! (2018-09-25)

Please join us for September meeting of Sydney Perl Mongers.

This meet is hosted by Broadbean, who are providing the venue and catering.

Time: 6-9pm (roughly)
Date: Tuesday, 25th of September 2018
Location: 9 Hunter Street, Sydney

(Meet in the ground level foyer or just outside and be brought up)

We have two speakers, one on Dancer and either a repeat of my Perl in OpenWRT talk or a fresh talk on doing REST in perl6.

Find this event on Meetup dot com: https://www.meetup.com/sydney-perl/events/253778201/


Please join us on Facebook: https://www.facebook.com/sydneypm
Meetup dot com: https://www.meetup.com/sydney-perl/
Or website: http://perl.sydney/

The way to create Class with only Perl core language.

Do you know that Perl have enough object-oriented features in core language?

Not necessarily you need to use CPAN module to do object-oriented programing.

I write the entry "The way to create Class with only Perl core language".

The way to create Class with only Perl core features

package Point;

sub new {
   my $class = shift;

  my $self = {
    x => 0,
    y => 0,
    @_,
  };
  
   bless $self, $class;

  return $self;
}

sub x { shift->{x} }
sub y { shift->{y} }

 

my $point = Point->new(x => 1, y => 2);

my $x = $point->x;
my $y = $point->y;

In fact, which do you need

1. simple object-oriented programing

or

2. advanced object-oriented programing

in your job?

Installing sets of modules

In order to quickly install a set of Perl modules for a given task, it is nice to have some kind of meta-package serving no other purpose than pulling in a set of other more specific packages. Traditional ways of doing this with CPAN can be found in the Bundle:: and Task:: namespaces. Recent developments, however, seem to have put meta-package maintainers in a predicament. Technologies are shifting once more. In this article, I explain how I rescued my meta-packages with minimal changes.

End of the Line Moose

Its Big Boss day here in the Moose-Pen

I was thinking of continuing on with the gum-shoe motif in my post but once it funny twice is dull and three times is just annoying so I will just dive into the real work for today. Looking at the test suite of Driver::DBI and fixing what has broke since I changes up the API all these many days ago.

I ran the full suite and the only one that failed was 't/40_joins.t' and it dies with about 300 lines of of waring and fails. Fortuntely 90% of them where;

Use of uninitialized value in hash element at ./Database/Accessor/Driver/DBI.pm line 325 
so better get that one first to make my debugging a little easier on the eyes; What I traced it back to was this input hash for a static link

Perl6::Math::Matrix (Part 3: when to use MMD)

In this guide about what to consider when writing a Perl 6 module, we (after part I and part II) will reach Perl 6's great power of signatures. They enable a feature, that is very often used in Perl 6 (internally and externally). Here are my arguments when the usage of MMD makes the most sense.

Perl Event Roppongi.pm #1 at 2018/9/14

Perl Event Roppongi.pm is opened at #1 2018/9/14

I get some pictures.

See all pictures Roppongi.pm Pictures

LOGOesque extension to Language::SIMPLE - Feature creep diverts attention.

In an attempt to standardise vector graphical operations in GUIDeFATE (the world's simplest GUI designer) across different back-ends and keep things simple, a little diversion was needed. For a standard vector drawing one might use the computationally cumbersome SVG format directly and draw that on the widget. The problem is that one needs to be able to manipulate the graphics easily and AFTER deployment. I needed to script the creation of the drawing. Now lots of applications use a script language of their own, e.g. gnuplot, matlab, Kalgebra, R etc, so clearly this is a useful functionality on its own. What would be also useful is a portable scripting platform. This platform could serve my purpose, but being modular, could be easily repurposed for other applications.

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is hosted by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.