Skip to content

Me: How hard can Perl really be? Perl: Ooh, a challenge!

Ok, the test program I wrote now works beautifully, as well as providing a bit of an introduction for me into Perl regular expressions. Also, I got down to business and wrote the program specification, detailing in English exactly what the program will do. At this point, all that’s left is to do is a little bit of research into how Perl handles functions, and coding the thing up. Shouldn’t take more than a few hours, total. I am confident that the program will be done by Friday night.

You know, I’m not sure I ever got around to mentioning what program I’m writing, or why I’m using Perl to write it. I’m going to quote the Program Spec:

The purpose of MusicFix is simple: to clean your music directory of duplicate files, and fix oddly formatted filenames. To use it, simply specify the root of a music directory.

MusicFix will recursively traverse that directory. It will then target and fix several odd filename formats… [cut for length] All filenames will then be normalized… [cut for length] While doing this renaming, some files may run into duplicates as their names become standardized. In this case, MusicFix will delete the smaller of the two files.

It does some other relatively minor stuff, but nothing too exciting. The thing to keep in mind is that this is a dangerous program: its main purpose is to rename and delete files, based on its own ideas of what is RIGHT. I’m going to test it out pretty thoroughly before letting it anywhere near my actual music. Once it’s ready, though, I’m going to make it available for public consumption, because I get the impression that I’m not the only person who’s sick of having music on my system which was apparantly ripped by a chimpanzee, to look at the filename.

Oh, and the reason I’m learning an entirely new language for this project is twofold. One, I haven’t learned Perl yet, but it’s been on my list of languages to get a feel of for quite some time now. I figure that writing a moderately complex utility in a language qualifies you to say you’ve got a feel for it. The other reason is that Perl was designed especially to handle weird regular expressions, which are the simplest way to handle the problem of extracting the information we want from the filenames and rewriting them to make sense.

On a related note, I just borrowed a manual from a friend of mine. On the back, it says “Teach yourself all about programming with Perl5 in a week!” I wonder if the authors realized that the average buyer of this book would be either a computer science student or professional programmer, and would therefore be able to pick up most of the applicable concepts with an expended effort of only a few hours? How many people who don’t otherwise know anything about programming would even believe such a claim?

RSS feed

Comments

No comments yet.

Sorry, the comment form is closed at this time.