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?

Day 19: Tracing your Perl program's execution (App::plstrace)

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

plstrace is a Perl script which can be used to trace your Perl program's execution. There are other "tracing" modules already available on CPAN, but I was inspired by the popular and immensely useful Unix utility strace, so the interface and output format of plstrace mimic that of strace.

Under the hood, though, things are different. plstrace currently can only trace user-defined subroutines and not Perl builtins. It is implemented by wrapping Perl subroutines with Perl subroutines during INIT phase. caller() has been adjusted so the wrapped subroutines does not see the trace wrappers (thanks to Hook::LexWrap). O/S system calls or external programs are not traced. And there are a few other technical limitations.

Porting Reddit's URL Structure to Catalyst Using Chaining

I wrote an article for the Catalyst Advent calendar:

Porting Reddit's URL Structure to Catalyst Using Chaining.

Any comments or questions feel free to leave them here.

New Dancer2 release already waiting on CPAN: 0.157000

Hey everyone!

A new version of Dancer2 has been shipped yesterday and is already waiting for you at a mirror nearby!

It has come to our attention that some people don’t follow public announcements made on mailing lists so I will also be releasing a public announcement on this blog when I release a new Dancer2 version (except patch versions).

A Note About Parsing Graphviz DOT files

I've just released GraphViz2::Marpa V 2.03 and GraphViz2::Marpa::PathUtils V 2.00.

GraphViz2::Marpa parses DOT files and stores the result in a tree managed by Tree::DAG_Node.

It ships with a default rendering engine which simply re-creates the original DOT file, minus any comments, since comments are discarded by the grammar used to parse the file.

GraphViz2::Marpa ships with 101 standard tests and 269 author tests.

GraphViz2::Marpa::PathUtils (a subclass of GraphViz2::Marpa in a separate distro) processes that tree in 2 ways:

1: It finds clusters of nodes connected to each other but not connected to other clusters, and splits each cluster out into a separate DOT file, maintaining the original DOT file structure. This means node and edge class declarations ensure the look-and-feel of the nodes and edges in these separate files is identical to what it was in the original file.

2: It finds all fixed-length paths starting from a given node.

GraphViz2::Marpa::PathUtils ships with 6 standard tests and 3 author tests.

Demo page for GraphViz2::Marpa.

Demo page for GraphViz2::Marpa::PathUtils.

Marpa's homepage.

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.