Sydney Perl Mongers August 2015

It's hard to believe its August already! Catalyst-IT have offered to host us this month, so I went ahead and booked their board room.

What: Sydney PM
Date: Tuesday, 18th August 2015
Time: 6-9:30pm
Where: Catalyst, Suite 501-504, 89 York St Sydney NSW

The building locks it's doors at 6pm, so one of their staff will let us in. The same as Broadbean, SiteSuite and others. For stragglers, a contact mobile number will be posted on the SydneyPM email list the day before.

Please like our FB page and Join our FB Event

Mystery Line in Proc Input in Perl 6

Here's something odd; not sure if it's a bug or just something I don't understand.

I have a utility on my system called k8temp which reports the temperature of the CPUs. It reports it in Celsius, so I thought I'd write a little wrapper that converts the temps to Fahrenheit. k8temp outputs one line per core, so on my dual-core system, the output looks like this:

abaugher@bannor> k8temp
CPU 0 Core 0 Sensor 0: 38c
CPU 0 Core 1 Sensor 0: 38c
abaugher@bannor>

And piping it to a hex dump looks like this:

What's your favourite CPAN module?

We've probably all got one or more modules that we're very thankful for. Maybe you use it again and again. Maybe the fact that it exists saved you from having to write it yourself. Maybe it's such a well-crafted module that you don't need to think about it, but always have it on your tool belt.

Maybe for/on CPAN Day, you could do or organise something related to that module, as a way to say thank you, perhaps to improve it for all of us?

Here are some ideas.

MadMongers (Madison Perl Mongers)

MadMongers (Madison Perl Mongers)

[From my blog.]

Accepting Input from Multiple Sources

One of the corners I often paint myself into when developing a tool is only accepting one type of input, usually STDIN, the standard input stream, like a pipeline (ex: cat fruit.txt | grep apple) or a redirect (ex: grep apple < fruit.txt)

What inevitably happens is I end up wanting the tool to work like any Unix tool and accept different kinds of input (filenames or arguments on the command line, for example.)

Finally I got fed up with it and added a function called multi_input() to my library. Here is how it works:

more

Benchmarking index() and regex in Perl 6

I noticed Perl 6 has a Benchmark module already, so I was wanting to use it, and Liz's suggestion of using index() rather than a regex in my last script gave me an excuse. The results were striking.

The script and results are below. Benchmark.pm6 doesn't have a cmpthese() routine, but timethese() does well enough. Below is the script, then the average times required for one grep through the array of about 150 lines. (I ran the script five times and averaged those times in the bottom row of the table.)

What did I learn?

Well, for starters, index() is at least 10 times faster than the best regex solution, and 100 times better than my first attempt. So that's the way to go, whenever possible.

On the status of HTTP::BrowserDetect

HTTP::BrowserDetect is at least 15 years old. I've had co-maint on it for 5 years now and I've summarized its current state of affairs. The full story is available on my blog.

RFC: Perl software of the year award

Earlier I wrote this blog post, which in summary says value of a Perl software project, as opposed to a Perl infrastructure project, is difficult to quantify until the software is written and used. And it often does not work nicely with our grant program where grant value has to be determined before the software exists.

For instance, if I request a $2000 grant to improve a popular Perl module's performance by 1000 times, I imagine I'll get the money provided I can demonstrate the performance improvement with some proof-of-concept code.

What if I propose to write face recognition software in Perl which finds your doppelgänger from images on the web? And if I request $5000? It's not hard to imagine your reaction will be "an interesting idea but how does it help the Perl community?"

ctags now supports Perl 6

We added support for Perl 6 to ctags. Give it a shot: grab a copy from GitHub.

Connecting Perl with SAP HANA

There are already a few blog posts around (e.g.
SAP Hana and r — the way of the widget), which mention that it's possible and, in fact, quite easy to connect to SAP HANA from Perl code using ODBC DBI drivers. As I'm planning to give a bit more specialized talk at this year's YAPC in Granada I thought it would be useful to describe the setup in detail and provide some references. In the follow-up posts I'll draw more on the topic of my upcoming talk: how ad-hoc OLAP DBs can be conjured with Yertl. BTW, I should probably add "yet another" to the prefix to the title of my blog post, to follow the widely accepted manner of affirming the prevalence of already existing ideas ;)

Refactoring Very Old Perl 5 in Perl 6

Back when I was first learning Perl, I'd been doing Unix system administration for a couple years, and one command I ran a lot was this one:

ps auxww | grep something

(On some systems it was 'ps -ef'.) That would get a full listing of all running processes and grep them for "something." I soon got tired of typing all that, so I made a shell alias:

alias pst='ps auxww | grep '

Developing virtualhost-aware PSGI applications: Plack::Middleware::MockProxyFrontend

Let’s say you work on a team that runs a web content management system for various different customers. It is hosted at ourcms.com, but each customer’s public content is published on a different domain, which is determined by a setting in the interface, which they can change at will. When a customer is logged into ourcms.com they see links to their public content in various places, and some of the public content has “edit this”-type links back into ourcms.com. All of this runs as a single PSGI application. A not unfamiliar scenario, presumably.

How do you spin up a development server where you can test this?

Do something for CPAN Day 2015

CPAN Day marks the date of the first upload to CPAN, on 16th August 1995. Last year was the first time we celebrated CPAN Day, and many of us did a lot of different things. Why not do something helpful for CPAN on Sunday 16th August?

Fun with Catalyst and Heroku

For my first experiments with heroku I decided to adapt an existing Catalyst application…

Minor Issue with Perl 6 Install on CentOS 6

I had a little hiccup while installing Perl 6 on a CentOS system, and thought I'd leave the details here in case it happens to anyone else.

[Update: This has already been fixed by one of the Perl 6 devs, who isn't able to login here to comment. Panda installs without needing lsb_release. So my kludge is no longer needed.]

I used rakudobrew, and installed rakudo with moar just fine. But "rakudobrew build-panda" failed with "Unable to execute 'lsb_release -a 2> /dev/null'". That lsb_release program wasn't installed on this system, but yum said I could get it from the package redhat-lsb-core. Unfortunately, when I tried to install that, it came up with a list of dozens of dependencies to go with it, including a lot of X stuff like ghostscript and libGL, even some sound packages.

From Sydney PM "EVANGELIZING PERL"

Stuart Cooper gave a talk at this last month's Sydney PM meeting. His talk was "analog" in that he gave it without slides from hand written notes with the purpose of provoking a guided discussion. The outcome was rather successful with people offering thoughts and experiences, along with references to websites and books. It was very productive and enjoyable.

He typed up and published his notes on the Sydney.PM emai llist, which are posted below with hyperlinks added for reference.

EVANGELIZING PERL
Talk by Stuart Cooper for Sydney.pm meeting, July 2015

1) Perl advocacy?
Not advocacy - evangelism - spread the word.
In the early 1990s Linux had some powerful Evangelists;
Linus himself, Jon 'Maddog' Hall etc and even one of the
world's top supermodels - Linux Evangelista.

Your target audience for your evangelism is your Linux-using co-workers.
They might be Ruby guys, DevOps guys, sysadmins, Java programmers,
any group of intelligent Linux users.

P6SGI: Perl 6 Web Service Gateway Interface

So, I have been meaning to start a Perl 6 blog for a couple of months. At that point, though, this site was having issues and I have this perverse desire to write blog software every time I think about blogging and so things got put off for a bit. I am now starting this here and I want to get write off and start with what I think is my most important Perl 6 contribution thus far and one I want to get your feedback on: P6SGI!

For those that need instant gratification, here is a P6SGI application:

    # Perl 6
    sub app(%env) { 
        (200, [ 'Content-Type' => 'text/plain' ], [ 'Hello World!' ]) 
    }

Job::Machine integration

Integrating Job::Machine into Djet.

Using Unicode in Emacs for Perl 6

I use vi/vim for quick edits and remote work, but I do most of my programming (and other work) in emacs. To enter Unicode characters in emacs, you run the "insert-char" command, which by default is tied to "C-x 8 [Enter]", then type in the hex code for the character or its name.

Typing at least 5 characters to get one got old very fast, now that there are some Unicode characters that can be used as Perl 6 operators. So I wrote a lisp function which asks for a single character and looks it up in an alist (kinda similar to a Perl hash). That way I can enter any Unicode character I've put in the alist by hitting two keys: one key to run the function, then whatever key I assigned to that character. Here's the lisp, which I put in my .emacs file:

Dancer2::Plugin::Auth::Extensible Presentation

Andrew Beverly is going to talk about https://metacpan.org/pod/Dancer2::Plugin::Auth::Extensible at the Perl Dancer Conference.

This talk will give an overview of what's now possible with very little code, including user registration, password resets and the management of user details.

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.