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.

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

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?

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.

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.

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.

About blogs.perl.org

blogs.perl.org is a common blogging platform for the Perl community. Written in Perl and offering the modern features you’ve come to expect in blog platforms, the site is run by Dave Cross and Aaron Crane, with a design donated by Six Apart, Ltd.