Beginners and Conferences

I've had many ideas for introduce Perl conference beginners into the community. Dom also had some ideas in How to make Perl conferences beginner friendly. Steal what you like, share what works!



Most notably, Domm had the idea of talk topics (or even outlines) that a beginner could claim (or be assigned). I certainly think this would help. I hate coming up with topics and love it when the organizers assign me one.

But, I've done other things too. I think the conference should be much more than talks and the spaces between talks. I'd like to see more small group activities.

User group topic: Script Spotlight

Wellington Perl Mongers had their monthly meeting this week and we tried something new that worked reasonably well so I thought I'd share it here. A little bit like lightning talks but with a more specific focus. From the announcement email ...

script-spotlight.png

Script Spotlight

Briefly tell us about a script you've written and use regularly. Things you might talk about:

  • What problem it solves - how it makes your life better
  • An interesting feature of the code
  • Ideas you have for making it better
  • What made it super easy (e.g.: a CPAN module, a feature of Perl, etc.)
  • Did you write your script in Perl - why/why not?

If you can't immediately think of a candidate script then here are some places to look to jog your memory:

  • your $HOME/bin directory
  • /usr/local/bin
  • your cgi-bin directory
  • scripts called from cron jobs
  • scripts called from your editor
  • scripts attached to a hot key
  • Nagios checks

See you there - with your script :-)

Use STRLEN not int for SvPV

Obscure bugs occur with the following type of code:

 unsigned int len;
 c = SvPV (sv, len);

The bugs occur typically on a 64 bit system. They happen because unsigned int may be a 32 bit integer, but the second argument to SvPV should be STRLEN, which is unsigned long int. Giving a pointer to a 32-bit integer where it expects a 64-bit integer causes some very odd bugs, and may even crash the interpreter. So, one has to always do like this:

 STRLEN len;
 c = SvPV (sv, len);

and never use anything which is not STRLEN type.

I have a collection of more weird and wonderful XS bugs, found through CPAN testers, here:

https://www.lemoda.net/perl/perl-xs-cpan-testers/index.html

Despite having known about this for years, I just found another instance in my own module, thanks to the warning messages from clang, in Text::Fuzzy:

https://metacpan.org/source/BKB/Text-Fuzzy-0.26/Fuzzy.xs#L51

I've just now updated it:

https://metacpan.org/source/BKB/Text-Fuzzy-0.27/Fuzzy.xs#L51

Perhaps it would be worth making some kind of automated checker to go through XS code and make sure the second argument to strlen is always STRLEN.

The emperor's new clothes

I noticed that I have been working on Data::Dump::Tree for 18 months which makes me a Perl6 developer with almost 2 years of "experience", \o/. What I know is that I am going to need a few more years to get around all it has to offer. But after two years it is still fun to learn new things about Perl6.

I also noticed that 90% of my time went into DDT, the rest went into two puny modules not worth mentioning, except that 3 modules sound better than one. Development takes times, development with documentation and test, and trying to get quality and functionality takes ages, no wonder Perl6 took this long; Actually it is pretty impressive what was achieved 2 decades.

My Perl Conference in Amsterdam Takeaway

Inspired by domm, I'm posting my takeaway of the Perl Conference in Amsterdam (which I wanted to present in-house anyway):

Perl 5 Porters Mailing List Summary: August 7th-14th

Hey everyone,

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

Enjoy!

Swiss Perl Workshop Pre Conf Meetup + More News For Attendees

Let's meetup for food and drink at L'Alchimiste restaurant in Villars, 24.08 at 19:00. Please add this to your schedule and/or let Lee know (via twitter: @lee_a_j or IRC: Lee or e-mail the orgs) so he knows roughly how many places to reserve. See http://act.perl-workshop.ch/spw2017/event/2016.

If you are coming from Germany please double check your train route as there are some issues with the tracks: https://www.tagesanzeiger.ch/panorama/vermischtes/reisende-steigen-nach-gleisvorfall-auf-flixbus-um/story/26874354

If you haven't yet signed up for the workshop, and are interested then there's still time: SPW 2017.

As always, many thanks to our sponsors:


Reading a binary file and printing it's contents as hex values

Seems like a trivial task - and it is.
But to get to the point on how to actually achive this with not that much code took myself around two hours.

Ask not what CPAN can do for you

If you're still not sure what to do on CPAN Day this year, you could help me with one of my trickle projects: help us get META.yml and META.json files added to CPAN distributions that currently have neither.

Send me an email and I'll assign you a distribution. I've ordered the list of distributions based on how far up the CPAN River they are. Fixing these distributions results in more accurate river data, and will also help various tools and services.

Perl 5 Porters Mailing List Summary: July 31st - August 6th

Hey everyone,

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

Enjoy!

Take a walk on the C side, ddt, du du, du du ...

Someone on #perl6 asked if Data::Dump::Tree (DDT) could display an int32 properly, and the adventure began.

I have programmed in C and C++ many years; from hardware related code to mangling libraries for RPC across different cpu architectures . Few years ago we had a very large testing and integration project that used Perl as the main development language; we had to write quite some XS even if we used SWIG extensively. So NativeCall is something that is really of interest even if nowadays I have little use for it, I still think it's a nice way of interfacing libraries.

Data::Dump::Tree works with types but NativeCall works with representation, types, and what I believe is dynamically create types for array (with VMArray representation), so it took some times to comprehend and get DDT to groak it.

The documentation for NativeCall is here https://docs.perl6.org/language/nativecall#Getting_Started

/Fizz|Buzz/

use v5.12.0;
use warnings;

s/\A(?:[0369]|[147][0369]*(?:[147][0369]*[258][0369]*)*(?:[147][0369]*[147]|[258])|[258][0369]*(?:[258][0369]*[147][0369]*)*(?:[258][0369]*[258]|[147]))*(?:0|[147][0369]*(?:[147][0369]*[258][0369]*)*5|[258][0369]*(?:[258][0369]*[147][0369]*)*[258][0369]*5)\z/Fizzbuzz/,
s/\A(?:[0369]|[147][0369]*(?:[147][0369]*[258][0369]*)*(?:[147][0369]*[147]|[258])|[258][0369]*(?:[258][0369]*[147][0369]*)*(?:[258][0369]*[258]|[147]))+\z/Fizz/,
s/\A[0-9]*[05]\z/Buzz/,
say
for 1 .. 100

Bailador, tests and docker

Bailador 0.0.10 has been released yesterday.

Basically it was a release that not really contained any shiny new features nor bug fixes. It was a release that addressed things we did wrong in our test cases. Tests especially matter whenever you want to install a module, so you could say that this version was just released to allow an installation of Bailador without running into errors.

So what happened?

Right after the previous release Gabor came along with a bug report saying Bailador raises an error during installation. The error itself happened in the test case 20-cli.t which can be considered as our first try to do some integration testing. Personally I think this is one of the test cases that didn't see much love, is not a pleasure to read, maybe because it is quite full of code and diags which are commented out. So let me point out a few things it does:

What I expect from a Web Framework

https://domm.plix.at/perl/2017_08_what_i_expect_from_a_web_framework.html

Celebration of "Completing 1000th consecutive days releasing to CPAN".

Couple of things I would like to share with fellow Perl Hackers, last month when I posted a blog about completing 1000th consecutive days releasing to CPAN, I talked about releasing new distribution to mark the day. Hence I came up with new distribution Calendar::Hebrew and released on the special day. I was hoping that my new distribution gets the attention of @PerlTricks, monthly series "What's new on CPAN". However as soon as I uploaded the distribution Calendar::Hebrew, I got email notifying the namespace Calendar::Hebrew is already owned by fellow Perl Hacker, "Yitzchak Scott-Thoennes".

I was little disappointed because of this, my new code would not be seen by others, specially @PerlTricks editor. I didn't want to miss the opportunity of getting mentioned in the July series of "What's new on CPAN". I sent an email to the owner and asked if he is planning to release code under the same namespace. To my surprise, I received reply with 24 hours, offering me the namespace. I was over the moon, honestly.

Information for SPW Attendees

This year's Swiss Perl Workshop in Villars-sur-Ollon overlaps with the historic hill climb, consequently there are some road closures that you need to be aware of if you plan to leave early or the day after the workshop. This isn't a big deal, it just means you will leave the village a different way to that which you arrived. The following flyer details the closures, I have translated the important parts below:

road_closures.jpg

Important bits: The road from Ollon to Villars will be completely closed between 9.30am to 12.30pm and 2pm to 5pm on both Saturday 26th and Sunday 27th August. Therefore the only bus running on those days between 9.30am and 5pm will be the 12.55pm (from Villars to Aigle and vice-versa).

If you wish to get down to the valley you will need to go via Gryon, to Bex. The train from Villars to Bex will not be affected by the road closures, nor will the cantonal road from Villars to Bex. There will be diversion signs in place to show you the way from Villars to Bex.

Any questions then please email Lee.

Log::Any - Now With Structured Logging

The first trial release of Log::Any with mephinet's structured and contextual logging support has been released for feedback!

These features make it easier to log structured data which will then be picked up by log parsers. Adding a single, unblessed hashref as the last argument to a log method will write that data structure as a compact entry at the end of your log string:

use Log::Any '$LOG';
use Log::Any::Adapter 'Stdout';
$LOG->info( "Hello, World", { foo => 'bar' } );

$ perl test.pl
Hello, World {foo => "bar"}

Even better, you can add values to the logging context, which will also add those values to the log string as a compact data structure. Using local will automatically remove those values at the end of the scope.

use Log::Any '$LOG';
use Log::Any::Adapter 'Stdout';
local $LOG->context->{fizz} = "buzz";
$LOG->info( "Hello, World" );

$ perl test.pl
Hello, World {fizz => "buzz"}

And you can combine the two:

SPVM is now 6x faster than Perl 5.26.

I'm delovelping SPVM on GitHub. and I release SPVM on CPAN

SPVM is currently 6x faster than Perl 5.26.

SPVM is not another implementaion of Perl. SPVM is a language and you can call SPVM function from Perl. Installation is very easy. "cpan SPVM" or "cpanm SPVM".

Don't afraid not to run CPAN module. You can use any CPAN modules and use SPVM together.

  use FindBin;
  use lib "$FindBin::Bin/lib";

  use SPVM 'MyModule2';

  my $total = SPVM::MyModule2::foo(3, 5);
  print $total . "\n";

Module file

  # lib/SPVM/MyModule1.spvm
  package MyModule1 {
    has x : int;
    has y : int;

    sub sum ($a : int, $b : int) : int {

      my $total = $a + $b;

      return $total;
    }
  }

  # lib/SPVM/MyModule2.spvm
  use MyModule1;
  package MyModule2 {

    sub foo ($a : int, $b : int) : int {

      my $total = ($a * $b) + MyModule1::sum(2, 4);

      return $total;
    }
  }

Perl 5.28 boolean check become fast

Perl 5.28 boolean check become fast.


This branch contains about 50 commits, which collectively optimise various aspects of perl's behaviour when detailing with boolean values or ops that are called in boolean context. various boolean-related optimisations - perl.git

Bencmark is very good!


   36 @  96.55% ..  99.99%
  245 @ 100.00% .. 100.99%
   28 @ 101.00% .. 109.99%
    7 @ 110.00% .. 119.99%
   10 @ 120.00% .. 129.99%
   29 @ 130.00% .. 199.99%
    4 @ 200.00% .. 299.99%
    1 @ 314.29%
so about 10% of tests became marginally slower - usually due to one extra conditional in an op to test for a private BOOL flag or ReANY(); about 70% of tests were almost unaffected, while 20% of tests showed improvement, most with considerable improvement, and a few with spectacular improvement. (The 314% is for an empty @lexical tested in boolean context). various boolean-related optimisations - perl.git

Perl 6 Data::Dump::Tree version 1.5

For those who do not know the module, Data::Dump::Tree renders your data structures in a tree fashion for legibility. https://github.com/nkh/P6-Data-Dump-Tree

It also

  • can display two data structures side by side (DDTR::MultiColumns)

  • can display the difference between two data structures (DDTR::Diff)

  • can generate DHTM output (DDTR::DHTML)

  • can display a folding structure in Curses (DDTR::Folding)

  • can display parts of the data structure Horizontally ( :flat() )

  • can be used to "visit" a data structure and call callbacks you define

  • install Term::ANSIColor and get colored output (highly recommended)

This blog entry is about the the latest changes.

I'll start with dd, the rakudo built-in dumper, which I learner to hate and love. I certainly love it when I am debugging my module and I can't use my own data dumper. I have in this version copied a few of its features which I found better.

This new release would not happen without the endlessly caring people on #perl6.

Snatched from dd

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.