Quantcast
Channel: peter.makholm.net » Perl
Browsing latest articles
Browse All 21 View Live

Benchmarking is hard

Benchmarking is hard to do right. Recently Jason Switzer found an old benchmark of the smart match operator written by Michael Schwern. Jason Switcher comments: If I were to publish a paper with such a...

View Article



When perfection isn’t good enough

One of the many possible problems with using CPAN modules is that they often just implement the parts of the problems the author needed a solution for. But once in a while you run into the opposite...

View Article

More fun with DESTROY

When I wrote about exception handling in Perl I mentioned briefly that DESTROY() methods should localize $? too. Try this script: #!/usr/bin/perl package Foo; sub new { my $class = shift; open my $fh,...

View Article

Benchmarking serialization modules

First you have to optimize for correctness, then you can optimize for speed. At the moment I’m working on a project where I do a lot of serialization, and to ensure that I could debug the correctness I...

View Article

New version of the Padre debugger plugin

I’ve just uploaded a new version of Padre-Plugin-Debugger to CPAN. It has been stuck in github for a while as I meant to write some documentation and start calling it version 1.0. But as I haven’t...

View Article


The evil of a global $_

I often write code like this: $_->store() for @objects; and quite often it actually works. But suddenly a piece of code doing this in a loop broke with this error message: Can’t call method “store”...

View Article

Why write an editor in Perl?

I’m a happy vim-user and I don’t see that change any time soon. But recently I have been hacking around with Padre, an editor writen in Perl and for Perl programmers. And even though I like my non-GUI...

View Article

Shell hacks: bash functions in files

Over the years I have collected a few shell snippets that have to be sourced or called as shell functions to work correctly. Having all these function definitions in a monolithic file sourced from my...

View Article


Regular Expressions: Beyond the fundamentals

At this years YAPC::EU I’m giving a talk about some of the more advanced features of regular expressions. Slides are available at http://hacking.dk/talks/yapceu2009/ – There is a pretty regexp...

View Article


Private methods in Perl5

It is common knowledge that you can’t have private functions and methods in Perl5. But it turns out that you can do it, one way is to use namespace::clean. Using this module you can either declare all...

View Article

HTTP::Engine is great

For simple web-based services I usually just use Perl and CGI.pm. After having read a bit about HTTP::Engine I tried it for a simple project yesterday. Beside my own logic it only took a few line of...

View Article

Optimizing ORLite.pm

While profiling some code making heavy use of Adam Kennedy’s ORLite module for accessing a SQLite database I found that most of my time was spend in DBI.pm. Sorted by inclusive time (ie. including time...

View Article

Benchmarking some ORLite variants

It would be nice if I could get my ORLite performance boost without really changing the (undocumented) API. So I got one more idea: Do the slicing in the ORLite generated code. It’s available in a new...

View Article


New Module: Benchmark::Serialize

Tim Bunce mentioned my blogpost about Benchmarking serialization modules in a post on the perl5-porters mailing list. He wished that someone would make that benchmark into a distribution on CPAN. How...

View Article

Reading Twitter with generic RSS reader

For a long time I have mainly been reading Twitter with a generic RSS reader (newsbeuter). Recently this stopped working when twitter.com disabled ‘HTTP Basic Auth’ in preference of using OAuth. Now I...

View Article


Wrapping mod_perl in Plack

Plack is one of these wonderful adventures in the modern Perl world that makes it fun to write Web applications in Perl again. But I have a few applications written with Apache/mod_perl and they are...

View Article

Splicing two sockets in Perl (request for help)

A couple of times I have written code which basically does this: accept() an incoming connection do some magic to get another socket start passing bit between the two sockets perform a correct close...

View Article


Creating a negative match RegExp object

It is a frequently asked Perl question how to write a regular expression that matches anything but “something”. The usual answer is that it can’t be done or that you need to use the !~ operator instead...

View Article

Deploying “Half of CPAN” on Debian using Carton

As systems developer I like just being able to pick the most useful Perl modules from CPAN and preferably use quite recent versions of the modules I need. On the other hand our systems administrators...

View Article

Reviewing my own regular expressions

Regular expressions are a wonderful tool, but as many other powerful tools they tend to be misused. If I had a penny for everytime I recommended against using regular expressions for parsing HTML...

View Article
Browsing latest articles
Browse All 21 View Live




Latest Images