Text Processing: Divide and Conquer

Another day another generic text processing problem that many developers have had to solve before. I have a list of patterns and need to find if they exist in a group of files. If I did not need to do complex post processing then I could just use the command line like so


grep -ri -f patterns files/

Sneak Peek of Beyond Perl Fundamentals

Safari has just posted a sneak peek of my new video course Beyond Perl Fundamentals, successor to a video course whose name should be intuitable :-)

Tons of hard work. Some people can sit in front of a camera and deliver a flawless lesson in one take. I flub. I spent many hours hand editing with Camtasia to sync separate audio and video streams and edit out every little click. Hope it was worth the effort.

How many ways to start a process do you know?

Note: The titular question applies only to different ways in Perl.

I am planning to write a small guide/comparison of the different ways to start a process in Perl and while thinking about all the ways i do know, became certain that:

1. my knowledge about the ways i know is not complete
2. there will be ways i do not even know about

Thus i am turning to the Perl community for help. Please tell me what ways you know to start a process in Perl and all of the permutations it can go through. :)

Idle alerts with bcvi

In case you haven't met it before, bcvi is a crazy backwards tool (written in Perl of course) that lets you type commands on a server to make things happen on your workstation. I've just released an update to the notifications plugin so I thought I'd blog about it here.

Here's a simple example to illustrate what the notifications plugin does. Imagine you've SSH'd into a server to kick off some long running command and you'd like to be notified when the command finishes. In this example, I'm running a database restore:

$ pg_restore -d acmecrm crm.pgdump; bnotify 'DB is restored!'

When the pg_restore completes, the bnotify command will be run. Bnotify is an alias for bcvi which will send a message back to your workstation to pop up a desktop notification.

CPAN modules for getting a module's path

I've written a review of CPAN modules for getting a module's path, as previously promised.

This covers 14 modules, some of which offer a lot more than getting the path, and two of which offer nothing more than that. As ever, please let me know if you know of any module(s) I've missed.

Perl interface to LDTP is gaining traction

I've written about the new Perl interface to the LDTP (Linux Desktop Testing Project) testing library that I had written. It already garnished some interest from people on Github. We've had some progress on that front you might be interested in. Also, we still need your help! :)

Perlybook features Perltuts.com

We added a new page to perlybook: http://www.perlybook.org/perltuts

On that page you can grab the tutorials that are available on Perltuts.com as mobi or epub book.

It was easy to integrate those tutorials: Write a small script that gets all tutorial names, store them in a cache and list them on the webpage. Write a source plugin for EPublisher and that's it!

Thanks to Mojolicious it's very easy to extend the webapp and the script to fetch the tutorial names was written within "a few minutes". For future web scraping tasks I'll use Mojo::UserAgent...

If you have ideas what sources we can integrate, please drop us a line at perlybook@perl-services.de!

Compiled db-4.8.30 for MinGW64

Installing DB_File has been a pain, especially when binaries for db is no where to be found and instruction is rare. After spending a lot of time going through Google search result, I finally found this good instruction.

The binaries are available here.

Optimizing compiler benchmarks (part 1)

Since my goal is to improve the compiler optimizer (staticly with B::CC, but also the perl compiler in op.c) I came to produce these interesting benchmarks.

I took the regex-dna example from "The Computer Language Benchmarks Game" at shootout.alioth.debian.org/

Ooh, pretty!

CPAN Ratings has had a face lift.

Mass-Testing Dancer's Plugins

cross-posted from dams blog

Mass-Testing Dancer's Plugins

So, as I said at YAPC::EU 2012, one thing that remains to be done before Dancer 2 can be released : migrating the plugins, making sure they work with it.

To be able to do that, what's best than an automatic testing facility ?

The goal is to get all Dancer plugins, test them with Dancer1, and Dancer2, and produce a report, to check which one fails and need fixing.

Step 1. Get the list of Dancer plugins.

Easy ! let's use Metacpan. After searching, I finally got a way to get the list of all modules that depend on Dancer. Then filtering out the ones that don't contain "Plugin" will do the trick.

Introducing HTTP::CookieMonster

If you've ever had the pleasure of poking around in your WWW::Mechanize or LWP::UserAgent cookie_jar, you'll know it's not an entirely painless process. It's certainly not impossible, but it feels a bit like jumping through hoops. The cookie_jar functionality in LWP::UserAgent and the modules which inherit from it is provided by HTTP::Cookies. Before I go any further, I'd like to thanks Gisle Aas for HTTP::Cookies, which is a very important bit of code. This isn't a complaint about HTTP::Cookies, but rather an attempt to make it even more accessible.

Before we do anything with cookies, let's make one request to ensure we have some cookies in our cookie_jar.

    use WWW::Mechanize;
    my $mech = WWW::Mechanize->new;
    $mech->get('http://www.nytimes.com');

Recent patches to GraphViz and GraphViz2

Hi Folks

GraphViz V 2.11 adds support for vdx (Visio) output, provided you've patched the underlying Graphviz code first. The patch is presumably downloadable from the Graphviz site. I run Debian so I did not test it, but the user who requested this patch assures me it works perfectly.

GraphViz2 V 2.04 requires Perl V 5.14.2 for utf8 support. Also, the code handling subgraphs was incomplete, and a small but significant set of patches there should now support all expectations for subgraphs.

Sample output for all demo programs. Search that page for 'rank.sub.graph' to see the new demos' output.

Subroutine Signatures - my Plan (v.1)

There has been quite a lot of discussion on p5p about subroutine signatures, so I figured I'd lay out my current vision here with as much details as I can. As more of this gets hashed out on p5p, I expect I'll add notes at the bottom (can I do that?) pointing to a blog entry for Subroutine Signatures - my Plan (v.2), etc.

All of this is what I'm working on, but I don't have a commit bit, so it's not going anywhere without getting thoroughly vetted and blessed first.

I'm posting my code at http://github.com/PeterMartini/perl, in the peter/signatures branch (meant to be kept in tandem with doy/subroutine-signatures).

GOAL:

Part 1:

In the scope of use feature "signatures" (or whatever)

sub foo($bar,$baz) {}
equivalent to sub foo { my ($bar, $baz) = @_; }
sub foo($bar,@baz) {}
equivalent to sub foo { my ($bar, @baz) = @_;}
sub foo($bar,%baz) {}
equivalent to sub foo { my ($bar, %baz) = @_;}

Part 2:

Paris.pm technical meeting

cross-posted from dams blog

Paris.pm technical meeting

( french version below )

The next Paris.pm technical meeting will happen the 25th september 2012, with:

  • Elizabeth Cholet: Firefox automatization with Perl using AnyEvent, Coro and MozRepl modules

Location : 181 avenue Daumesnil, 75012 Paris, France

Google map : google map

If you are interested, and live in Paris, please join us ! If you need more info, ask in the comments.


La prochaine réunion technique de Paris.pm se tiendra mardi 25 septembre 2012, et le programme est :

  • Elizabeth Cholet : l'automatisation de Firefox avec Perl en utilisant AnyEvent, Coro et les modules MozRepl

Adresse : 181 avenue Daumesnil, 75012 Paris

Google map : google map

Si vous êtes intéressé, n'hésitez pas à venir, entrée libre et gratuite. Pour plus d'info, demandez dans les commentaires.

dams.

Testing scripts in your distribution, portably

This is a summary of the things I had to do, to add a simple test case for a script that I added to one of my distributions. It's taken over 2 elapsed days, 3 developer releases, and two sessions on IRC, to get to the end. I'm writing this up (a) so I don't forget, and (b) in case it's useful to someone else, and (c) in case the peanut gallery can point out any further gotchas I've missed.

Some interesting modules xreffed by their subject matter

Hi Folks

Sometimes when scanning the feed of module releases from MetaCPAN, I see a module which I don't have a use for, but which I think I'd better make a note of.

I keep these notes in a TiddlyWiki, and I've just extracted them as a new page
here .

OK. Nothing amazing, but it amuses me....

HTTPS-Everywhere rulesets for Perl sites

HTTPS-Everywhere is a Firefox and Chrome extension brought by the EFF to automatically use https:// URLs instead of http:// if the site supports that. Think about what happens when you type http://github.com instead of https://github.com/ in your address bar.

So I added rulesets for PAUSE, BitCard and MetaCPAN.

Design considerations for Alien::Base

Anyone who has been following my progress on Alien::Base knows that in the past few months I have been struggling to nail down the final problem, namely Mac’s library name problem. The short story is, on Mac, the library has the full path to the module baked into the library during compilation. My problem is that I don’t tell it the correct path during compilation. Why?

The comma operator

Beginners are often startled by the following Perl behavior, and I admit this is one side of Perl that is not really attractive (anymore? or ever?):

$a = 6, 1, 1, 1, 7; say $a; # 6
$a = (6, 1, 1, 1, 7); say $a; # 7
@a = (6, 1, 1, 1, 7); $a = @a; say $a; # 5

Why such seemingly inconsistent and strange behavior?

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.