It’s been a while since I gave any attention to my CPAN modules but as an incentive to get more hands on with git I added them to my own gitweb, fixed the two that were failing tests and tided up some of the complaints from CPANTS. I’m sure I’ve missed something (or got it flat out wrong) but it’s nice to have at least a local copy of my modules without any issues remaining. Read on →
Stemming is the process for reducing inflected (or sometimes derived) words to their stem, base or root form. – Wikipedia article on Stemming Ever used a website that allowed you to tag content? Ever ended up accidently using slightly different tags? Something like graphs and graphing or blog and blogs? (I hope so, otherwise it’s just me…) To spot some of the more obvious overlaps you can stem each of the words and look for a common base. Read on →
Since the release of Perl 5.10 (back on 2007/12/18) there have been a fair few articles discussing all the shiny new features - including smart matching, a built-in switch and state variables but my favourite three haven’t really received much coverage. So I’ll add to the pile of blog posts. First up is a tiny (from the outside anyway) change that may have the biggest impact of all the new features on my day to day perl - the display of the actual name of uninitialized variables. Read on →
While dabbling with Puppet I’ve spent a fair amount of time investigating facter, one of the tools (although puppet uses it as a library) it’s built on. While I quite like the format it uses to define a fact I’m hampered by my lack of ruby experience; simple things take me longer than they should. So when I noticed Pfacter while looking for a module on CPAN recently I thought I’d have a look at how it could be done in perl. Read on →
After heading to the Nordic Perl Workshop and watching sessions by Jonathan Worthington and brian d foy I decided to have a little play with Perl 6 and see if I could port my Daemon Percentages script (Perl 5 and Ruby versions already exist) to Perl 6. Thanks to material in the slides from the above sessions and asking a couple of questions in #perl6 I got a basically working Daemon percentages Perl 6 script running on my Windows desktop under pugs in a couple of hours (I had problems finding an example of the substitution). Read on →
In my Simulating Typing in Perl post I included a small chunk of perl for varying the typing speed of a fake user. While it works it did have some oddities that were noticeable by a sharp eyed viewer. Thanks to a pointer from Mark Fowler I’ve now revised the script slightly and included String::KeyboardDistance. This nifty module knows how far away keys on the keyboard are from each other and so helps to smooth the delays out a little; for example the string ‘aaaaa’ is now typed much faster than before (because there is no travel involved) where as ‘qpqpqpq’ will be slower due to the finger movement - although I’m not bothered enough to make repeated sequences faster. Read on →
You’d think it would be easy - have a program type a previously written program at a human speed (minus the typos). Vim has record and reply functionality but it’s done with typical vim efficiency: yes, instantly. At EuroOSCON a couple of years ago Damian Conway handed out a presentation tidbit, he uses the hand_print function from IO::Prompt to make himself look like a master typist. Well, he could just have been saying that to make us feel better, maybe he can type that fast… Anyway, I tried a simple example using the module: #!/usr/bin/perl use strict; use warnings; use IO::Prompt qw/hand_print/; hand_print("I am not really typing this..."); It works but the typing speed is so uniform it makes it obvious over past a handful of lines. Read on →
For reasons that are too dull to post about (yes, even on THIS blog!) I spent some time today looking at Log::Dispatch. Bob (the afore mentioned bigger boy) then made^Wsuggested I integrate it with the shining example of wasted time that is Twitter. So I (not very) proudly present: Log::Dispatch::Twitter! Now, where’s the build system source code…
While digging in to some large log files recently I needed to work out which daemons were causing the most noise, so I wrote a little perl script called daemon_percentages.pl. It was short, ran quickly and did what I wanted. And then my lunch plans were cancelled due to rain. With nothing but boredom, a newly compiled version of ruby and the google homepage at my side I decided to write a version in ruby. Read on →
I wrote the WebService::Yahoo::SpellingSuggestion perl module for one of my little side projects. It was easy to wrap, seemed to work fine when I did a few tests by hand and didn’t take very long to be CPANised; I’m trying to stay in good habits and treat all my internal modules as if they’d be released - I just skimp on the tests a bit. Which I know is bad. Unfortunately, while it was fine for the light testing, I wasn’t very happy with it once I started to use it for heavier loads. Read on →
I’ve just uploaded the initial release of WWW::Shorten::Smallr to CPAN and it should be making its way through the mirrors right about now. The module itself is simple, it shrinks the given URL using the http://smallr.com/ web site. I wrote this for two reasons, firstly smallr is the official link shortener of one of the mailing lists I frequent and I wanted it available from the Vim Shortener I wrote. Secondly I wanted to have another play around with Module::Build. Read on →
Last year I was quite interested in the Description of a Project (DOAP) project. I added DOAP files to all my Sourceforge projects, wrote some little util scripts, contributed DOAP files to a couple of the Free software projects I use that had asked for them… and then promptly forgot all about it. A couple of recent posts about the Python Package index and DOAP interested me enough to dig out one of my half-finished scripts, it’s the (very messy) first pass of a CPAN META.yml to DOAP converter for the automatic creation of DOAP files for perl modules. Read on →
The File::Find::Rule::VCS module excludes certain directories, artifacts from version control systems, from your File::Find::Rule queries. While it’s aware of the big two (subversion and CVS) today I needed a version that was aware - and can ignore - RCS directories. So I hacked the module and tada, we now have a File::Find::Rule::VCS RCS support patch. I’ve sent a copy to the module author but I’m putting it here as well in case it gets rejected.
Any attempt at explaining why I wanted to do this will sound odd so for now I’ll just post the one liner… perl -MLWP::Simple -e 'get("http://www.dhs.gov/") =~ /dhs-advisory-(\w+)\.gif/;print "Threat level is $1!\n";' This gets the current threat level for the US and prints it to standard out.
If you are not already subscribed then it may well be worth subscribing to the CPAN RSS feed. It’s very easy to let little gems like Test::URI slip through. The downside of course is that I am slowly running out of things I can’t test!
I’ve added a new entry to my miniprojects page, the getpageranks script (written in Perl) allows you to pass in a file containing URL’s, one to a line with whitespace and comments allowed. Each entry in the file will then be checked with Google and the PageRank will be displayed. Note: If an invalid URL is given the PageRank will be returned as zero, this makes it very difficult to determine which sites are invalid and which are just unpopular. Read on →
Unless you run IE on Windows with the Google toolbar installed it’s always been difficult to determine the PageRank of any given URL, while a FireFox/Mozilla extension was created it was, from my experiences, very flaky. It also required manual use. I was pleasantly surprised today to see a module called Google::PageRank hit my local CPAN mirror. I’ve had a quick play and it worked on all my test cases. Tool writers, start your engines!