Perlito - reviewing some older code

Today I've finally updated the Perlito compiler ChangeLog, this covers a little more than a year of commits.

The most significant update was the new Perlito5-to-Java backend, which is work-in-progress. It covers a lot of ground, but there is a lot more.

There were also some interesting new Perlito5-to-Javascript features, such as regex /e modifier, and file operators support in nodejs.

The Perl6 backends have not been updated, but things still work.

While reviewing the README-perlito6 file, I've found some interesting stuff that I haven't touched in a while - here is a piece of generated code that goes through 3 different languages:

CPAN is 20!

Perl hackers have now, as of today the 16th August 2015, been uploading Perl modules onto CPAN via PAUSE for 20 years. Andreas König, who did that first upload, is still releasing to CPAN, and as I write this his most recent upload is the same module that was first released to CPAN.

This post is a brief summary of CPAN's history.

Happy CPAN Day!

Can you believe CPAN has been around for 20 years today? Two decades is a long time! Yet, I cannot imagine my workday without it.

My contributions to the CPAN Day celebration:

Helios 2.83 is a minor release of the Helios distributed job processing framework. It contains official SQLite support for the first time, better schema DDL for Oracle databases, and some cleanup of some files with mixed-format line endings.

Helios::Logger::HiRes 1.00 is the first stable release of a plugin module
providing enhanced logging features to the Helios framework, including
sub-second timestamp precision (provided by Perl's Time::HiRes) and a
command line log searching tool.

Thank you to everyone who contributes to CPAN, both package contributors and those that maintain CPAN itself. Happy CPAN Day everyone!

The newly-released Regexp::Assemble V 0.36

I'm now co-maint of Regexp::Assemble. V 0.36 has been uploaded to CPAN.

Perl開発の助成金プログラムについて

This is a Japanese summary of Grants Committee Charter, How to write a proposal and Grant Benefits.

YAPC::Asiaが目の前に迫ってきました。日本のPerl使いの皆様向けにThe Perl Foundation内のGrants Committeeの活動を紹介します。

以前Grants Committee委員の牧から案内がありましたように、Grants CommitteeはPerlの開発に貢献する個人に1万ドルを上限として助成金の交付を行っています。もちろん日本の皆さんも対象で、最近はmoznion氏のPerl::Lintが採択されました。以下に私たちの活動理念と助成金の応募方法を記します。少し長いですがどうぞお付き合いを。

Grants Committeeの紹介

Grants Committeeは米国非営利法人、Perl Foundation内の最大勢力を占める委員会です。

Grantは日本語に翻訳しにくいのですが、助成金委員会とでも申しましょうか。オープンソースの活動は個人が自分の時間を使って無報酬で行われることが多いものの、人間は霞を食べて生きるわけにはいかないため、Perlのプロジェクトを通してPerlの成長に貢献してくださる方にGrants Committeeが助成金を出しています。

委員長は私、野崎が務めています。委員はコミュニティの代表を世界各地から集める方針を取っており、アジア・太平洋地域からは牧大輔とKaren Pauleyが選出されています。その他北米4人、欧州の4人の委員に加え、アジア・北米・欧州からGrant Managerという役職に1名ずつついており計14人の所帯です。

助成金の申請から採択、支払いまで

流れはこのようになっています。

  • 提案の送付(フォーム)。このようなプロジェクトををするのでこれだけの助成をされたい、という内容を送っていただきます。メールアドレスなど個人情報を除き、内容は公開されます。
  • 奇数月の中旬にパブリックコメントを募集し、委員による投票が行われます。
  • 賛成多数で採択。提案に沿って実行していただきます。なお月一度の進捗報告が求められます。
  • 計画達成後、現金が支払われます。

参加する利点

採択されると助成金に加えてこのような利点があります。

  • 専属マネージャーが割り当てられ、進捗管理とTPF間の仲介をしてくれます。
  • TPFお墨付きのプロジェクトになり、世界中から注目が得られます。

FAQ的なもの

英語は必要か?

英作文が必要になるのは以下の場合です。

  • 提案の作成、質問への返答
  • 進捗報告
  • 支払い手続きなど事務的なやりとり

READMEを書く手間プラスαくらいでしょうか。牧によると「英語が問題ならば多少のお手伝いはできます」そうですよ!

申請額はどうやって決めたらよい?

上限が1万米ドルという以外、特にガイドラインは設けていません。過去の申請額を参考にするのがよいかと思います。なお2014年2月までは上限が3000ドルでした。

寄付金で成り立っているプログラムのため、時給換算ではさほど多くの額は望んでいただけないことをご承知ください。

支払いは?

計画達成後、委員会が確認したあとに米ドル建ての小切手が郵送されます。小切手はシティバンク銀行などで換金できます。銀行振り込みもできないことはないのですが、国際送金手数料の負担をお願いしています。

ちなみに円安の今がチャンスです。

財源は?

TPFに寄付をしてくださった皆様のおかげです。末筆ながらTPFに寄付をしてくださった法人・個人の皆様に感謝いたします。

お問い合わせ

tpf-grants-secretary at perl-foundation.orgへどうぞ。

Converting glob patterns to regular expressions

Let's say you have a glob pattern with shell-style wildcards from a config file or user input, where ? matches any character and * matches any string (0 or more characters). You want to convert it to a regex, maybe because you just want to match it (and Perl already supports regexes) or because you want to embed it as part of a bigger regex.

You might start with a naive replacement:

s/\?/./g;   # ? -> .
s/\*/.*/g;  # * -> .*

Unfortunately this is broken: It leaves all other characters untouched, including those that have a special meaning in regexes, such as (, +, |, etc.

Let's revise it:

Raise hell, or bugs, on CPAN Day!

If you've got one or more distributions on CPAN, then on CPAN Day you could go through them and see if there are any ideas you've had which aren't listed in the issue tracker (typically RT or github issues).

If you don't have any distributions on CPAN, then you could go through the modules that you regularly use and see if there are any issues you could raise.

I'll expand a bit on what I mean, and why it might be a good use of your time.

Seeking helpers for Net::DHCP

Are you sitting at home thinking "I've got all this free time, I really want to make use of it playing around with bitstrings using pack and unpack" ?

Your search is over! I need your help!

For some time now I have been chipping away at enhancements for Net::DHCP. Recently I have begun adding tests using packet captures from the real world. Naturally this has created a laundry list of possible enhancements including DHCP options which need special attention to make sense of.

That and the tangled web of quirky clients which require dhcp options to be in certain (non-numeric) order - for no logical reason.

I have a TODO list which is naturally just a list of ideas which some keen person with tie on their hands might like to help me with, check it out at: https://github.com/djzort/Net-DHCP/blob/master/TODO

Please fork and submit PR's!

Swat and Mojolicious

Hi. I continue to share some swat news. SWAT is automation test framework written on bash/perl and providing a simple DSL to rapidly create smoke tests for web applications.

Mojolicious is a ... ok ... everybody knows it :) - well known web application framework.

Recently I found it quite interesting idea of generating swat tests for existed mojo applications using routes introspection.

So this is how I created Mojolicious::Command::swat

This is a draft, I have not even uploaded it to CPAN, but if someone interested - may play with it - https://github.com/melezhik/Mojolicious-Command-Swat ...

Swiss Perl Workshop - Register (and Get Prepared) for the Perl 6 Hackathon

This post is mostly geared towards Perl 6 newbies who plan to attend the Perl 6 Hackathon at the Swiss Perl Workshop 2015 in Olten, on Thursday, 27 August 2015.

First and foremost: Don’t be shy and come even if you have never contributed to the Perl 6 ecosystem. Neither have I, and I will be there. There are always tasks that do not require insights into the Perl 6 toolchain. This hackathon is pretty much a one-time opportunity for Switzerland. There will be a dozen of Perl 6 core hackers on site, and some of them will even help you get Perl 6 up and running.

Please add yourself to the list of attendees. We will then organise a seat and food for you. On the link mentioned, you will also find extensive information and links to preparational material. (Thank you, Wendy!) Most of the text below is copied from there.

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:

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

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 ;)

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.