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?

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:

Usage: checkdep PAUSEID [options]

-a|--all        Work on all dependencies, not just the author's
-m|--module     String; Work only on a specific distribution. (eg: Mock::Sub)
-z|--zero       Include dependencies listed with a version of zero
-h|--help       Display this help screen

/update

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:

Highlights from TPC 2017

Disclaimer

This list contains just a small number of talks that I personally thought are important/enjoyable for the most readers. This is by no means an official list curated by an organization. See the YouTube playlist for all awesome talks. I also encourage you to write your own blog about TPC. And yes, it’s officially called “Tipsy” now!

Where did my test fail?

Although I tried to select talks with videos, I had to make an exception for this one. I wasn’t able to locate neither videos mentioned in this section.

On Tuesday night, Damian Conway talked about his new modules: Dios lets you declare classes with Perl 6 syntax, which uses Keyword::Declare to declare a couple new keywords it needs. Data::Dx and Test::Expr also utilize “adding new keywords”. First one is a wrapper around Data::Dumper, and second one is a Test module that prints out source code when an error happens, which apparently was not a thing yet. Pretty awesome, right?

Because CPAN Needs More Templating Modules

Why learn a whole new language for templating when you already know a perfectly good one? This isn't the first module that allows you to embed Perl in your templates, but it's yet another one.

Template::Compiled on MetaCPAN.

Perl 6: Seqs, Drugs, And Rock'n'Roll

Read this article on Perl6.Party

I vividly recall my first steps in Perl 6 were just a couple of months before the first stable release of the language in December 2015. Around that time, Larry Wall was making a presentation and showed a neat feature—the sequence operator—and it got me amazed about just how powerful the language is:

# First 12 even numbers:
say (2, 4 … ∞)[^12];      # OUTPUT: (2 4 6 8 10 12 14 16 18 20 22 24)

# First 10 powers of 2:
say (2, 2², 2³ … ∞)[^10]; # OUTPUT: (2 4 8 16 32 64 128 256 512 1024)

# First 13 Fibonacci numbers:
say (1, 1, *+* … ∞)[^13]; # OUTPUT: (1 1 2 3 5 8 13 21 34 55 89 144 233)

The ellipsis () is the sequence operator and the stuff it makes is the Seq object. And now, a year and a half after Perl 6's first release, I hope to pass on my amazement to a new batch of future Perl 6 programmers.

Ravada free, easy to use VDI broker made with Perl

Ravada is an open-source project that allows users to connect to a virtual desktop.

http://ravada.upc.edu/

Its back-end has been designed and implemented in order to allow future hypervisors to be added to the framework. Currently, it supports KVM and LXC is in the works.

The client only requirements are: a web-browser and a remote viewer supporting the spice protocol.

It is very easy to install and use, following the documentation, virtual machines can be deployed in minutes. It is an early release but is has been used in production. The frontend has been built with Mojolicious and the hypervisor connections are made with Sys::Virt . It is open source and the code can be download from github. Contributions welcome !

Main Features:

  • KVM backend for Windows and Linux Virtual machines
  • LDAP and SQL authentication
  • Kiosk mode
  • Remote Access with Spice for Windows and Linux
  • Light and fast virtual machine clones for each user
  • Instant clone creation
  • USB redirection
  • Easy and customizable end users interface
  • Administration from a web browser

See some screenshots, documentation and more at http://ravada.upc.edu/

Perl 5 Porters Mailing List Summary: June 12th-19th

Hey everyone,

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

Enjoy!

SPVM is released! Perl maybe become much fast.

I release SPVM.

SPVM

---------------------------------------------------------------------------

SPVM - Fast calculation, GC, static typing, VM with perlish syntax
SPVM(CPAN)

----------------------------------------------------------------------------

Do you know that there are many criticisms against Perl 5 on the Perl 11 blog?

Much of the criticism is about Perl's data structure and performance.

"Perl does not have a good data structure and implementation regarding numbers."

"Perl can not calculate a number using the stack of functions."

"Understanding about virtual machines is lacking in p5p."

I am an engineer who loves Perl 5 and p5p and is using Perl 5 to create a company service.

I want to contribute to reducing the weaknesses of Perl 5, by making modules.

I hope the SPVM will be of help.

Features

Do you need faster Perl? SPVM provides fast calculation to Perl.

SPVM is released!

Les Journées Perl / French Perl Workshop 2017

Nobody seems to have blogged about Les Journées Perl so I thought I would blog about Les Journées Perl. Or maybe I haven't been paying attention, or it passed by me in a state of crossing timezones?

I was travelling back from the UK office the weekend the workshop happened, so stopped by. I also uploaded a couple of photos to the perl_events Instagram feed. The workshop was held in the Carrefour numérique in the Cité des Sciences et de l'Industrie in Paris - a very interesting space within a very interesting space. Possibly one of the most interesting spaces I've been that has hosted a Perl workshop. Here's a recap of the talks I understood that stuck in my mind, I believe the talks were recorded so may appear online soon. You can find all the talks, with links to slides/etc here.

how to join #yapc chat on irc.perl.org

  • IRC is used A LOT during The Perl Conference
  • To go online instantly in a browser, you can use Mibbit
  • To stay online (to read all messages sent, even the ones sent when you were not around), you can use IRCCloud
  • You can set up your own bouncer too!

Introduction

Last year's The Perl Conference at Orlando was my first one. I had a lot of fun, met with brilliant people and learned numerous things about Perl.

Altoids tin Arduino GPS "return to origin" project, thanks to Perl

Warning! Long read...

This post contains an Arduino Trinket Pro GPS prototype project that only relates to Perl in that all of my knowledge and experience came from my Raspberry Pi Perl work, along with writing C/XS code for several ICs and sensors and making those available as Perl APIs. I'm posting it here due to that relevancy, and because I don't blog anywhere else ;)

To start off, I'll explain a little bit how I got to this path.

I became interested in the Raspberry Pi after a colleague showed me a project he had built with one. I went out, bought a couple and started tinkering. The very first thing I wanted to do was use Perl on it. There were a couple of libraries available, but they seemed convoluted to me, so I wrote my own.

Another reason not to use each()

So I’ve learned my lesson. Do not use each().

Always good to read the blogs…

http://blogs.perl.org/users/rurban/2014/04/do-not-use-each.html

Here’s a fun one that caused perl to go into an infinite loop. I suppose being frugal and not assigning things to variables is not necessarily a good idea.

  #!/usr/bin/perl

  use strict;
  use warnings;

  my %thingies = %{{qw/a 1 b 2 c 3/}};

  my $c=0;

  #while (my ($a,$b) = each %thingies ) {
  while (my ($a,$b) = each %{{qw/a 1 b 2 c 3/}} ) {
    print "$a $b $c\n";
    last if ++$c > 4;  # stop the madness
  }

Uncommenting out the line above where each uses a pre-assigned version of the same data element works fine. Not knowing anything regarding the internals of Perl makes me scratch my head. I’m sure there is a perfectly good explanation for this and maybe it has even been corrected in a more recent version of Perl?

20 Years of Perl mongers

It was 20 years ago (almost) that a group of New Yorkers started Perl mongers. I think at the time we were eating something the caterer for The Perl Conference called "California sandwich" that had sprouts and avocado. In 1997, there was a small core of a Perl community that worked on perl, but there was still room for regular user engagement.

I didn't see this coming. While I was in Amsterdam a couple of weeks ago, Wendy noted that 1997 and 2017 end in the same digit (as does 1967). I don't think we've ever bothered to celebrate an anniversary. I went to check on the date. I registered pm.org on August 22, 1997, which I think makes August 21 the birthday. That was the last day of that conference.

We'll have to do something special guess.

I know that NY.pm will have its anniversary this year, and there my be some other groups. London.pm, when did you start? I think Boston and Seattle was in there very quickly. Who else?

New Sydney PM website and URL

With new cool TLD's available, I purchased perl dot sydney which is the perfect domain for Sydney Perl Mongers.

Our current/old website is dated and tired, so I also spent some time whipping into shape a new website using GH pages. Having GH pages automagically compile markdown files into HTML is very neat. Plus having everything in github so people can PR, and having group access - are both great. But... that Jekyll isn't Perl does make me feel somewhat sold out, even if it's being used implicitly.

Anyway, please take a look and proof read the perl dot sydney website. Send PR's for all my typos and grammatical errors (people in irc.perl.org's #australia have already gone over it)

Also, if you would like to order one of our Tshirts (which help pay for these vanity domains and our meetup page) - check out the details on our Facebook page.

Perl 6 Release Quality Assurance: Full Ecosystem Toaster

Read this article on Perl6.Party

As some recall, Rakudo's 2017.04 release was somewhat of a trainwreck. It was clear the quality assurance of releases needed to be kicked up a notch. So today, I'll talk about what progress we've made in that area.

Define The Problem

A particular problem that plagued the 2017.04 release were big changes and refactors made in the compiler that passed all the 150,000+ stresstests, however still caused issues in some ecosystem modules and users' code.

The upcoming 2017.06 has many, many more big changes:

  • IO::ArgFiles were entirely replaced with the new IO::CatHandle implementation
  • IO::Socket got a refactor and sync sockets no longer use libuv
  • IO::Handle got a refactor with encoding and sync IO no longer uses libuv
  • Sets/Bags/Mixes got optimization polish and op semantics finalizations
  • Proc was refactored to be in terms of Proc::Async

Bailador documentation

The documentation of Bailador was updated. It looks much better now.

The many ways to use Alien

A while back I introduced the alienfile recipe system and we wrote a simple alienfile that provides in a CPAN context the tool xz and the library liblzma. I also went over how to test it with App::af. The week after that I showed how to integrate that alienfile into a fully functioning Alien called Alien::xz and promised to show how to then use that Alien from an XS or FFI module. Today I am going to do that. I am also going to show how to use a tool oriented Alien module. (conveniently, Alien::xz can be used in either library or tool oriented Alien mode). If you are more interested in FFI or tool oriented mode feel free to skip down to the appropriate paragraph.

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.