Perlbuzz news roundup for 2012-11-19

November 19, 2012 Uncategorized No comments

These links are collected from the
Perlbuzz Twitter feed.
If you have suggestions for news bits, please mail me at

Using WWW::Mechanize to get my scratchy 45s

April 4, 2012 Uncategorized 3 comments

I’m a big fan of WFMU’s Beware of the Blog. So much music geekery and arcana in one handy source!

Sometimes there will be a post with lots of MP3s for download, like this one today with long-forgotten 45s of songs paying tribute to Merle Haggard. I don’t want to listen to the mp3s in my browser, and I don’t want to manually do the Save As dance in the browser.

Perl and WWW::Mechanize to the rescue! If you have WWW::Mechanize installed, you also have the mech-dump utility. mech-dump started as a tool to make it easier to create WWW::Mechanize programs by showing what form fields exist, but it does more than that. By default, mech-dump will fetch a page and display the forms and fields on the web page. If you call it with –links, you’ll only get back the links, like so:

alester:~ $ mech-dump --links http://blog.wfmu.org/freeform/2012/04/a-tribute-to-the-hag-mp3s.html
... etc ...

Filter that output through grep and pass it to xargs and wget, and you’ve got a handy MP3-only downloader.

alester:~ $ mech-dump --links [big URL] | grep mp3$ | xargs wget
--2012-04-04 09:27:32--  http://blogfiles.wfmu.org/GG/Skeeter_Harmon_-_A_Tribute_To_The_Hag.mp3
100%[=======================================================>] 4,935,323   4.08M/s   in 1.2s
... etc ...

I suspect very few Mech users are aware of mech-dump, and how handy it can be from the command line. I wish I’d done a better job of publicizing it.

Parrot tickets now converted to GitHub

January 16, 2012 Uncategorized No comments

The Parrot project is now using
GitHub’s issue tracking system.
Parrot has used GitHub’s source code control for months now, but
we had hundreds of tickets in the
Trac system.  Now,
over the past few weeks, I’ve been working with
Rick from GitHub
to migrate the tickets out of Trac into GitHub’s issue system.

Like most data conversion projects, the challenges were less about
the coding and more about making the decisions about how to massage
the data between two similar systems.  For example, Trac has fields
for Severity and Priority of tickets, but GitHub only has free-form
tagging, so I had to create GitHub tags that correspond to Severity
and Priority in Trac. GitHub’s tracking system doesn’t handle file
attachments, so my conversion code had to make inline comments of
the file attachments.

Most time-consuming of all was the conversion of users from Trac
to GitHub.  We needed the issue history to have accurate user IDs
on them, so I needed
a big lookup table to do the job.
While users like “coke” and “chromatic” have the same user IDs on
both the Trac instance and GitHub, Trac user “jonathan” is “jnthn”
on GitHub, and so on. Anyone I couldn’t find a match for became
generic user “Parrot”.

actual code to do all this
is only about 200 lines of Perl code, which should be no surprise
for someone who has the CPAN at his disposal. I used
Net::Trac to
read from the Trac instance, and the
JSON module to write
out JSON files in the GitHub API format.
The bulk of the code is
project-specific conversions to make little data tweaks like change
severity to tags, and to make the output code a little more friendly
in Markdown.

I have to specifically thank Rick at GitHub for helping us through
this project.  I used a lot of his time with questions about how
GitHub would handle my import format, and we had two test imports
for us to see real results, so that I could adjust my conversion
process. The final results are beautiful, and the Parrot team is
excited to see this move made.

I’ve long been a fan of GitHub
and how they help out the community,
and this just adds to it.  This sort of aid to open source projects
should stand as an example to other companies that work with open
source.  Many companies give back to the communities of the projects
on which their businesses are based.  It’s fantastic to have a
company willing to use human capital actually working with a project
in which they have no direct involvement.  In helping us, GitHub
gains nothing but the grateful thanks of the Parrot project.

Perl is not an acronym

August 10, 2010 Uncategorized 5 comments

A reminder to those out there, especially HR folks, that the language Perl is always spelled “Perl” and never “PERL.” From the [Perl FAQ](http://faq.perl.org/perlfaq1.html#What_s_the_differenc):
> Before the first edition of *Programming perl*, people commonly referred to the language as “perl”, and its name appeared that way in the title because it referred to the interpreter. In the book, Randal Schwartz capitalised the language’s name to make it stand out better when typeset. This convention was adopted by the community, and the second edition became Programming Perl, using the capitalized version of the name to refer to the language.
> You may or may not choose to follow this usage. For example, parallelism means “awk and perl” and “Python and Perl” look good, while “awk and Perl” and “Python and perl” do not. But never write “PERL”, because perl is not an acronym, apocryphal folklore and post-facto expansions notwithstanding.
Those post-facto expansions are “Practical Expansion and Reporting Language” and “Pathologically Eclectic Rubbish Lister.” Both are bacryonms, created after the language was named.

Allison Randal on how open source is more than code

May 29, 2010 Uncategorized No comments

Allison Randal has some insights from her Twitter stream today about how open source is more than just a way to create and share code.

Open source isn’t just a licensing/business strategy, it’s a better way of producing software and a better way of training developers. The driving principle of the academic model is to make students fail. The bell curve rules, if all students pass something is ‘wrong’. The driving principle of open source is to help each developer reach their own greatest potential. Good developers are good for the project.

Handling multiple SSH keys in your SSH config

May 27, 2010 Uncategorized 2 comments

I’ve been frustrated lately trying to juggle multiple SSH keys on various servers I’m on. If I’ve got one set up to the Subversion server at work, then I can’t authenticate with github. If I let github be the server that I have a private key for, then I’m entering a password whenever I do an “svn up” on the work server.
I played with ssh-agent, but that seemed to require starting up a process every time I logged in, and I couldn’t get it running in my .bashrc, and it required manually adding keys.
And then I stumbled across [this article](http://www.ibm.com/developerworks/aix/library/au-spunixpower.html) that introduced me to the IdentityFile argument. Now I have this in my ~/.ssh/config and all is well with the world.

Host github.com
HostName github.com
IdentityFile ~/.ssh/github_rsa
User petdance

Perlmonks users, your passwords have been published

July 30, 2009 Uncategorized No comments

Just in case you missed my Tweets about it, or don’t read any other Perl blogs, or didn’t receive the mail sent out from Perlmonks, Perlmonks was compromised. Passwords for users were published to the net.
Carl Masak has this [analysis of the passwords](http://use.perl.org/~masak/journal/39373) and their weakness. It’s clear, too, that many of the passwords were standard passwords meant to be used on multiple sites.

Hooray for the circling pundit vultures

January 15, 2009 Uncategorized 3 comments

SD Times columnist Andrew Binstock has come out with [another poorly informed column](http://www.sdtimes.com/INTEGRATION_WATCH_THE_END_FOR_PERL_/About_JAVA_and_PERL_and_PYTHON_and_GOOGLE/33186) that says nothing more than “Perl hasn’t updated in years, and therefore is irrelevant.”
Let’s look at his errors and FUD:
* Not recognizing Perl 5.6, 5.8 and 5.10 as “major releases”
* “Perl’s penchant for near-hieroglyphic syntax.”
* Quoting TIOBE as a meaningful indicator of anything.
* “Perl 6 release is still a long way off” — Can you tell us when it will be, Mr. Binstock?
* “still five years later, we’re years away.” — Apparently, he thinks he can, and he’s wrong.
* “Perl has only the original Perl implementation plus an experimental version in Haskell under development.”
So, although I wish he wouldn’t have written such an error-filled column, I’m still glad he did. Why? Because he’s showing that Perl is anything but irrelevant or doomed.
If Perl were truly doomed, and Perl 6 were never going to come out, then why would he bother writing a column about it? Why not write a column about how nobody uses COBOL or Forth? That Perl and the future of Perl is a topic for publication just shows that Perl is anything but dead.
For more about the bright future of Perl, including Perl 5, see Piers Cawley’s excellent article [“The Perl Future”](http://www.heise-online.co.uk/open/Healthcheck-Perl-The-Perl-Future–/features/112388)
> I see an active Perl 5 community, working on and with, excellent tools on CPAN… I see Perl 6 and Parrot hitting their targets. This isn’t crystal ball gazing. This is what’s happening now…. Perl isn’t moribund. 2009 won’t be a make or break year – I doubt we’ll see fireworks, but I think that developments like Perl-On-A-Stick and Moose will continue to make life easier for curious newcomers, old hands and even returnees like me.

Write your tests before you fix the bugs: A shining example from PHP

December 8, 2008 Uncategorized 3 comments

I went to upgrade our PHP install today, but found that:
> [PHP 5.2.7 has been removed from distribution](http://www.php.net/archive/2008.php#id2008-12-07-1)
> Due to a security bug found in the PHP 5.2.7 release, it has been removed from distribution. The bug affects configurations where `magic_quotes_gpc` is enabled, because it remains off even when set to on. In the meantime, use PHP 5.2.6 until PHP 5.2.8 is later released.
This is one of those cases of “you write a test for anything that has ever gone wrong.” If the PHP guys have any clue at all, they will have written many tests of all the possible ways that `magic_quotes_gpc` can get set incorrectly, *before* fixing a single line of source code.
(For those unfamiliar with this peculiar misfeature of PHP, `magic_quotes_gpc` lets you automagically instantiate global variables based on GET and POST variables, which allows bad guys to muck with your code by passing in parameters that they know will mess with your code when turned into globals.)

Lightning talks from outside the echo chamber

December 5, 2008 Uncategorized 1 comment

I’m already tired of the hoohah about “Perl 5 is dead” and the hand-wringing and the useless flapping about what we should do. I’m more interested in what is going on in Perl that none of us have heard of yet.
If I didn’t have family and book obligations, I’d gladly take two days off and an 18-hour round trip to Omaha, Nebraska to check out the lightning talks presented by the University of Nebraska at Omaha on Tuesday. [Robert Fulkerson](http://www.cs.unomaha.edu/faculty/people/fulkerson.html) [posted to the Omaha.pm list](http://mail.pm.org/pipermail/omaha-pm/2008-December/001955.html):
> The Fall 2008 UNO CSCI 2850 (Programming on the Internet) class
> invites you to an evening of lightning talks on Perl programming,
> the Firefox web browser and other (mostly) web-related topics.
> Lightning Talks are no longer than 5 minutes and can be about
> anything: a new idea, an evaluation, an observation, a story, a
> complaint, an explanation, a suggestion, a report of success or
> failure, a call to action, a description of a technique, technology,
> or a lament.
> Usually we split the talks over two nights, but this semester it’s going to be one, big solid night of talks.
> Where: Peter Kiewit Institute, Room 252 ( http://tinyurl.com/5g83cb )
> When: Tuesday, December 9th, 2008
> Time: 6:00 PM until 8:30 PM
> Topics
> * Writing a Greasemonkey script for FireFox to make BlackBoard tolerable
> * Obfuscating Perl
> * Connecting Perl to databases
> * Net::SSH::Expect
> * Using BioPerl for sequence analysis
> * Perl Google APIs
> * Acid Test 3
> * Gossamer Forum
> * Perl vs. Python
> * Index a website starting with a single page
> * Dictionary attack using Perl
> * iTunes playlist extractor: C++ vs. Perl
> * Regex Creator
> * Regex Coach
> * History of Perl
> * Software Pirating Debate (Spore, SecuROM)
> * Perl 6 vs. Perl 5
> * Rapid Exploit Development using Perl
> * SSH on iPod Touch
> * Regex usage in Perl vs. C
> * Ubuntu with Conky
> * Perl-XML: XML Made Easy with Perl!
> * Perl Module – GD::SecurityImage
> * Gmail:Checker module
> * Improving Perl program efficiency/performance
> * Subversion Tortoise client search
> * Perl PayPal APIs
> * JQuery UI
> * Talking to LCD projectors using Perl
“Talking to LCD projectors using Perl”? “Rapid Exploit Development using Perl”? “Perl 6 vs. Perl 5” by someone who (I assume) is not part of the core group? Someone get this on tape and YouTube ’em, willya?
I would *love* to be there. (Plus, then I could go get some [Valentino’s](http://www.valentinos.com/) pizza).