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.

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?

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 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.

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 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.

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.]

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.

Day 18: Checking unsaved files (File::Unsaved)

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

No, I'm not tempted to do a pun, despite the aptness of the situation :-)

File::Unsaved is yet another one of my little modules. Its one and only task is to check whether a file is "unsaved", that is, opened in an editor and has unsaved modifications. Currently it has support for several editors: Emacs and joe (on Unix; I haven't checked how it/they work(s) on Windows with regard to signalling unsaved files), and vim.

Quoting the POD, here's how it works:

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.

My Perl recruitment thoughts

Dave Cross posted his Perl Recruitment Thoughts, which led to the same tired responses we see every time someone is frustrated enough to bring it up. Again. In the past decade I've written this post about every six months, decided it wasn't worth the shitstorm I'd get for posting it, and let it die. This time, I'll write just the highlights, turn off comments, and let people who care enough rant do it on their own blogs.

First, Dave does quite a bit of work to make new Perl programmers. He teaches accessible and cheap classes in London (and anywhere that will have him). I don't work in UK, so I can't speak to the particular things he sees. I teach all over the US, write the books, and occasionally step into companies to un-screw up whatever they have going on. Here's what I've learned in 20 years of doing this, but, as I said, just the highlights.


Day 17: Checking process existence and listing processes (Proc::Find)

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

Proc::Find is little module that can help you write this shell idiom in Perl and avoid shelling out:

# check a process by name
ps ax | grep -q mplayer
if [[ $? == 0 ]]; then echo "mplayer process exists"; fi
pgrep mplayer
if [[ $? == 0 ]]; then echo "mplayer process exists"; fi

In Perl:

use Proc::Find qw(proc_exists);
say "mplayer process exists" if proc_exists(name=>'mplayer');

Proc::Find can find/list processes by other criteria other than name: pid, full commandline match, program's binary path, user/UID (other criteria can be added in the future). For example:

use Proc::Find qw(find_proc);
my $pids = find_proc(user => 'ujang'); # find all process owned by ujang

Note: this module is inspired after reading CPAN ratings for Proc::Exists. :-)

Inline Grant Nearing Completion

See our blog: http://inline.ouistreet.com/

The Inline grant work is, um, working! Just a few things left to do, and we'll call it a wrap.

The dream of "use 7;"

The dream of "use 7;".

    use 7;

Perl is now a under a curse that Perl never can't do major version up .

This is very bad in Perl future.

Perl and Perl6 is now different language, but For the naming of that, many outside people of Perl community think Perl6 is the version up of Perl.

Now, Perl and Perl6 is different language. If so, version number should be up independently. For exampe,


Perl 1, 2, 3, 4, 5, 6, 7, 8, ...
Perl6 1, 2, 3, 4, 5, 6, 7, 8, ...

The problem that Perl can't never do major version up is big problem than Perl core team expect. This is unnatural and strange.

Thoughts on workplace debate

As always, if I make a post about business in general rather than about Perl in particular, I do it on my Other Blog.  As I have done this week.  Check it out, if you’re interested.

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.