Day 24: Games!

About the series: perlancar's 2014 Advent Calendar: Introduction to a selection of 24 modules which I published in 2014. Table of contents.

I'll close this series by mentioning that in August I created a few simple text-based games: Games::WordGuess, Games::Hangman, Games::ArrangeNumber. The reason I did this originally was because I got sick of playing word guess/hangman on Android with English words, and there doesn't seem to be any support for Indonesian version. So I found out about Games::Word::Wordlist::* modules on CPAN, uploaded a couple of Indonesian wordlists, and had to write a couple of games for using the wordlists too, since there happened to be no text-based hangman game or word guessing either on CPAN at that time).

I've always sucked at interface/interactive things though, so I welcome any patches/pull requests for improving the gameplay. I've got a couple more ideas for simple games, but lost interest after a few days, so those ideas will still remain in the backburner for now.

Epilogue

Leaving Crumb Trails -- Talking to Myself

The past me is another person. Sometimes antagonist, sometimes friend, past me (postaction?) had ideas, hopes, and dreams and developed some of them into software that I and others use. Unfortunately, that asshole left bugs all through the code for me to fix.

I can't blame him. Nobody's perfect, not even idealized/demonized copies of my past self. But I do have to fix them, and deal with the messes he left.

Lucky for me, while he was writing buggy software, he left extensive notes for me to use...

About one-liners

It's not that I don't see the utility for one-liners, it's just my own mindset that seems to prevent me to use them.
On one hand, I often explain to other (non-Perl) developers how useful can be a one liner, but on the other hand I tend not to use them even when I could.

Tis the season to get Inline

Have you been naughty or nice?

David and I have been busy elves!

Day 23: App::chart and Text::chart

About the series: perlancar's 2014 Advent Calendar: Introduction to a selection of 24 modules which I published in 2014. Table of contents.

Text::Graph module, which I have also used, but ran into some minor problems and limitations in formatting. Unfortunately there's not much thing to show right now as the only type of chart implemented is sparkline (but this is not available in Text::Graph).

And there's a CLI for that(TM). chart (from App-chart) is a CLI for Text::Chart that accepts data from command-line arguments or YAML/JSON/Perl file and can output graphs for you. Examples:

Some Perl modules cross-referenced by Purpose

For your delectation.

Saint Perl 6 Hack Day wrap-up

Saint Perl 6 started with its hack day instead of putting it at the end. I can summarize some of the proceeding, but some of the end-of-day reports were delivered in Russian. Someone else will have to fill in the blanks.

I mentioned my CPAN Testers from GitHub idea and some people looked into it. Miyagawa has a gitpan.pl gist that fakes out CPAN.pm with CPAN::Inject. That's interesting, but many of the tools, such as CPAN::Reporter, depend on the various CPAN clients. Miyagawa's cpanminus can install from GitHub, and there's Garu's App::cpanminus::reporter, but that fragilely depends on the output of cpanminus as it does its work. It's a simple matter of programming to fix that. From there, the group moved on to other things (which someone else will have to write about).

Michael McClennen gave this talk at MadMongers last week. It is...



Michael McClennen gave this talk at MadMongers last week. It is about implementing Web Data Services.

NOTE: I posted this earlier this week, but totally screwed up the video. This time it’s working.

[From my blog.]

Day 22: Safer system() alternative (Sys::Run::Safer)

About the series: perlancar's 2014 Advent Calendar: Introduction to a selection of 24 modules which I published in 2014. Table of contents.

Sys::Run::Safer is an attempt to create a safer API for running programs.

As we might already know, Perl's system() may or may not call a shell depending on a number of things. If we want to avoid a shell, doing system @ary or even system $cmd, @args is not enough as Perl might still invoke shell if @ary is only 1-element long or when @args is empty. I realized and got reminded of this myself only recently, it was a long time ago since I read the documentation for system() and I've been system @ary all these years thinking it was enough. You actually need to do this ugly thing to make sure you avoid a shell: system { $ary[0] } @ary which I'm pretty sure a lot of people don't remember or bother to use. Thus, it's an API mistake.

Thank You, Glen Hinkle!

A very quick post just to say that I'm very excited to get into work today and it's all because of Glen Hinkle and his Amazing Mojocasts.

TIMTOWTDI - matching regular expressions with events

In the past I had a task, run hundreds thousands of regular experssions
on millions text documents, and it should run fast (run time should
be measured by seconds).
Perl regexp alternation may be good option for that, because it put all
regexps on one trie structure and passes them at once, but I needed more
than simple match. I had to know what regexp was matched and exact position
of match, and much more. Trying to optimize matching process, I found that
my options to interact with regexp engine during matching process are very limited.
I decide to write my own regexp engine, I thought it shouldn't be too
complicated (when I found I'm wrong it was too late :-) ).
Basic idea is that every matching event will have it's own handler and
will run immediately as this event happens. Matching handler will get
relevant information from regexp engine and send back orders how to continue
matching process.
I created Regexp::SAR (Simple API for Regexp) module. Most code written in C/XS.

Perl/Tk Spreadsheet Editor

This is as far as I could approximate a Perl/Tk UI to Microsoft Excel. No, I don't want to create a clone of Microsoft Excel. But I was interested in how much one could lift the style of the plain old Tk. And I like the look and feel of Excel, so it was kind of inspiration for me.

perl-tk-spreadsheet-editor.png

Unfortunately, there is no way around the built-in border color of the Tk::TableMatrix used for the grid.

Searching the web, I read of people that coded their own spreadsheet using a Tk::Canvas and a lot of widgets. Unfortunately, none of these solutions is available anymore. And I don't want to code it again.

So, does anyone has such a piece of code and would it be possible to share it? I'm curious how it looks like and how it behaves in terms of performance.

Day 21: Checking if a string contains shell wildcard (String::Wildcard::Bash)

About the series: perlancar's 2014 Advent Calendar: Introduction to a selection of 24 modules which I published in 2014. Table of contents.

Spam from waag.org

Today I got this spam message:

From: Tessel van Leeuwen <tessel@waag.org>
Subject: Invitation: Join the Apps for Europe competition and win 5,000 euro!
To: undisclosed-recipients:;

Hello,

I'm writing to you because I found your email address on the website, http://act.useperl.at/apw2014/wiki?node=HackaThon, and I would like to invite you to enter the Apps for Europe competition: ... <snip>

There are a couple of things about this I find interesting:

  1. As far as I can tell, my email address is not on the linked page.
  2. The message has no visible recipients (so I guess my address was listed in BCC).
  3. I've never done anything with apps.
  4. The Austrian Perl Workshop was 2 months ago. Why harvest the hackathon page for email addresses now?

ZipRecruiter Wants You

By now I'm sure that some of you have heard about ZipRecruiter, the job board startup that recently picked up $63 million dollars in funding and whose backend is written almost entirely in Perl using DBIx::Class, Catalyst, Template Toolkit. And they use sqitch for sane database management.

You'll probably recognize some of the names of people who work with them. Randal Schwartz has been consulting with them for a year. Mark Jason Dominus works there and has released some nifty open source software he wrote for them and while I don't claim to be as talented as Randal or Mark, I have been consulting there for a while now. It's huge amounts of fun. There are also tons of men and women who aren't as publicly involved in tech communities who are nonetheless very talented.

They're growing like mad and hiring for quite a few positions. And yes, they need Perl developers (and Python, and Javascript, and, and, and ...). And they do allow remote work.

The 2014 White Camel Awards

In the lands where the camel roams, the white camel is a rare and revered individual. Each year, The Perl Foundation recognizes significant non-technical achievement in Perl with the White Camel Awards. This is the 15th year we've done this, and I don't think anyone will be surprised by this year's recipients. Oh, and happy birthday Perl (from Saint Petersburg and Saint Perl 6, GMT+0300)!

Perl community - Amalia Pomian

Amalia Pomian takes care of everything when organizing the cluj.pm events: booking the place to hold the meetings, creating the schwag, taking care that the guest speakers have a great itinerary here, arranging the talks, promoting the events, keeping in touch with all the participants, and most other things.

Perl user groups - VM Brasseur

Day 20: Creating test databases (Test::WithDB)

About the series: perlancar's 2014 Advent Calendar: Introduction to a selection of 24 modules which I published in 2014. Table of contents.

Here's one little module that can help you create dummy databases during testing: Test::WithDB. It's great together with Test::DatabaseRow (which happened to be featured in this year's Perl Advent Calendar by MARKF).

PS: I'm still not happy with the module name. It should probably not reside under Test::, or even contain any "Test" in its name. Suggestions welcome.

So what problem does this module try to solve and how to use this module?

During testing, often we need to create temporary databases that will be filled with tables and data, tested, then dropped again. If you use SQLite then this is a no-brainer as SQLite works with plain files, you can just point to a temporary file/directory created by File::Temp. However, if you use a client/server-based database then usually you'll need some administrator-level privileges to create and drop databases.

MetaCPAN Welcomes our Newest OPfW Interns

You may have already seen the news. The latest round of GNOME's Outreach Program for Women is now underway.

I will have the pleasure of acting as a mentor for Rose Ames and Andreea Pirvulescu. My main responsibility is to make sure they have no significant blockers, so CPAN authors, don't be surprised if I reach out to you on their behalf at some point. They'll both be blogging about what they're up to, so feel free to follow Rose's blog and Andreea's blog to keep up on the latest news from them.

Michael McClennen gave this talk at MadMongers last week.



Michael McClennen gave this talk at MadMongers last week.

[From my blog.]

CPAN Testers from Github?

At the pre-Saint Perl 6 dinner, we were talking about ideas for the hack day. I mentioned something David Farrell and I had talked about a couple of weeks ago.

I'd love to kick off CPAN testers from Github. Instead of uploading a dev version to PAUSE, I'd commit to some special branch, or create a special tag, or something, then get the same results I get now.

I have no idea how this would work or how the CPAN Testers would find out about the new releases. Maybe there's a central point that polls Github repos and acts as the central point for CPAN Testers to poll.

How it works depends on what the testers are willing to do and what's easiest to get going.

Ideas? Comments? How could this thing work?

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.