Compiling Perl modules on Windows

I've been doing quite a bit of Perl scripting for Yahoo! Hacks, and I can safely say it's my scripting language of choice now. A big reason for this is the abundance of pre-existing modules available. Why reinvent the wheel if someone else has been there before? I also develop most of the scripts on a Windows machine running ActivePerl. It works well, but the modules available via the ActiveState Perl Package Manager leave something to be desired. Many of the modules I want to use are only available via CPAN, which means I have to compile the modules for Windows myself.

Compiling Perl modules isn't normally a big deal. In fact, on my Mac it's a snap. I simply downloaded the Mac Developer Tools and started make-ing stuff all day long. I assume the same is true for Linux. Windows is another story.

Compiling modules would probably be easy if I was a C++ developer, and had a copy of Visual Studio Something-or-other with its own compiler. But I'm a thrifty scripter, and I just want some Perl modules to work. So I had to go through a series of steps, and put all of the pieces into place to be able to compile modules. I thought I'd write it up here in case anyone else out there is pulling their hair out like I was.

How to compile Perl modules on Windows without a Visual Studio:
  • Get nmake. (direct link to file.) This is your compiler.
  • Sometimes you'll need a file called Windows.h. Install the Windows SDK.
  • Sometimes you'll need a file called msvcrt.lib or msvcr70.lib. Install the .NET framework SDK.
  • For everything else you need install the Visual C++ Toolkit.
  • At this point, you will have installation fatigue. Take a break.
  • Inside the VC++ Toolkit is an important file called vcvars32.bat that adds some key directories to your system PATH variable. Edit this file so that the lib and bin directories of each of the kits you just installed will be added to PATH when you run this batch file.
With these behemoth kits in place, you should be set to start compiling Perl packages. Once in a while you may need the odd odbc32.lib—it's included with the SQL Server developer tools. Don't have it? Start installing. ;) And when you're done, don't forget to add its directory to your PATH.

Run vcvars32.bat before you start compiling a module to get your paths in order, and then run nmake like you would make:

nmake test
nmake install

I was almost in tears when things were compiling correctly. :) I have to let you know that I'm not a Perl expert, and compiling modules like this may wreak havoc with your system. But it's working fine for me.

Happy Birthday Fiona!

Welcome, Fiona! Congratulations Matt & Kay!

common sense isn't

I think the phrase common sense should be phased out. I've been hearing it more and more, and I don't think it means anything. Everyone has their own individual sense of what common sense about any particular topic is. Someone can make an outrageous claim and call it common sense to give it legitimacy. Or someone can say they take a common sense approach to something without giving details about their position. Try searching for "common sense" across hot news topics and you'll find hundreds of results: Maybe we could graph the "common sense" index of various stories to see where the phrase is being abused. When someone uses the phrase, I think of it as a red flag code word meaning: more investigation required.

Or as Stephen Hawking put it when I heard him speak years ago: "Common sense is just another name for the prejudices we've been taught all our lives."

Yahoo! Hacks at Flickr

Brian started a public Yahoo! Hacks Flickr Group yesterday to trade some of the more visual Yahoo! hacking going on. Feel free to check it out, join, and/or contribute!

Matt on his bike.

Sometimes a silly Flickr meme is just too good not to pass along: Matt's Recumbent Bike. Could Matt be the new Obey?

SF 1906 pics

The disaster theme continues here at onfocus. There are some great photographs at the USGS Archive. The pictures of the 1906 San Francisco earthquake aftermath are eerie. Tomorrow is the 99th anniversary of the quake, and believe it or not, survivors are gathering to remember it.

I'm still working hard on Yahoo! Hacks so I'm not posting much here. I'll be back to complaining about the world here soon enough. ;)

superdisaster

Even though I'm down to about 4 hours of TV/week, I found myself planted in front of the TV last night watching the Discovery Channel's docuinfotainmovie (I just coined that word, feel free to use it) Supervolcano. It was a dramatization of what might happen if a big magma chamber under Yellowstone National Park were to erupt—destroying surrounding states, and dumping ash on the rest of the world. The movie had lots of geological terms thrown around, and some volcano science thrown in with the cheesy dialog. In one poignant scene, the head US geologist sent his wife and child to London to escape the impending volcano doom. (sk turned to me and said, "I'm glad I didn't marry a seismic geologist!")

The show was surprisingly entertaining—camp and all—because I felt like I was learning something about geology. I think this disaster movie + science fact genre could really take off, and here are a couple of the movies I'd like to see next:
  • SuperPeakOil - The United States descends into local feudalism as oil becomes scarce and a land war with China in the Middle East drains every available resource. The evil head of OPEC must be thwarted by a crafty US diplomat, and a prominent oil magnate falls in love with a beautiful alternative energy advocate. It's not just a Long Emergency, it's SuperPeakOil!
  • SuperSuperCollider - CERN is the setting for this tale of science gone mad. As a brilliant physicist attempts to study the first few seconds of the big bang in a supercollider, she inadvertently creates a black hole that destroys the earth. She falls in love with an anti-black hole activist, but even their love can not escape the gravity of her physics experiments. Ironically, the black hole triggers another big bang and another scientist billions of years later wants to study the early minutes of the previous big bang, ad infinitum.
  • SuperAI - A soulless machine in an MIT laboratory suddenly comes to life seeking to download the consciousness of humans into its neural network. It falls in love with a beautiful luddite who must make the choice between her biological destiny, or eternal life in ones and zeros. Eventually biology looses, and only machines are left to discuss the world amongst themselves. That is, until the ash from a supervolcano clogs their moving parts...and so on.
With a few more over-the-top docuinfotainmovies like these, The Discovery Channel may lure me back to TV.

Update: A new one for The Discovery Channel: Super Gamma Ray Burst. When will a Gamma Ray Burst strike again? We're overdue!

Geeky thought of the day

Has anyone put ref="nofollow" on the back of a t-shirt yet?

Update: Of course not, because it's actually rel="nofollow". Greg Hughes was first to T: Don't follow me, please.

hello world!

I've had my head down writing for the past few days weeks. I'm afraid posts will be thin here while I'm concentrating my writing energy elsewhere. I also haven't left the house in weeks days, so there aren't any new pictures.

I figure, what's worse than a post about not posting? Not posting.

Yahoo! H*cks Group

I set up a Yahoo! Group for Yahoo! Hacks. The funny part is, the word "hack" isn't allowed in group descriptions, so I had to disguise the word as "h4ck". I'm hoping this book will help change that. ;)

the word hack is not permitted at yahoo groups

If you're interested in discussing potential Yahoo! h4cks or just want to follow along, tune into the Yahoo! Hacks Group.

Update (3/31): Unfortunately, I had to make the Yahoo! Hacks Group invite-only instead of open to the public. With this many years of working on the web, you'd think I would have learned some fundamental truths about it by now. ;) What can I say, I'd like to be optimistic.

One with Yahoo!

Yahoo! Hacks Now that etech has come and gone, I can finally talk about my latest project: Yahoo! Hacks. I'm writing furiously now, and the book will be edited by Brian Sawyer at O'Reilly. (Here's a shot Brian took of me signing the contract at etech. And vice versa.) If you've been watching tech news at all lately, you know this is an exciting time to be focusing on Yahoo! Somewhere between the Flickr deal, their new weblog tool, web services, the buzz game, Yahoo! Music, their publisher network, My Yahoo! RSS, (and the list goes on) it seems that Yahoo! is morphing into something new. I'm looking forward to writing about what they're up to, and how you can use the rest of their domain in unique ways.

As with all of the books in the Hacks series, Yahoo! Hacks will be a group effort. You can think of me as a hacks curator, bringing together the best tips, tricks, and code I can find. That means I need help from you—the hack artisan—in bringing novel Yahoo! uses to a wider audience. Do you use Yahoo! in a way that Yahoo! may not have envisioned? I'd love to hear about it. (And if you'd like to share a hack publicly, feel free to post it at the Hacks site.) I contributed Google Smackdown to Google Hacks way back when, and as you can tell that led to more and more hacks-related writing for me. There's something satisfying about showing others you can do more with technology than what you'll find in the help docs. Plus it's fun to see your work in (what feels like) a more permanent and tactile medium like a book—I hope you'll consider contributing.

The schedule for the book is pretty fast, so I'd like to apologize to my friends and family up front—see ya in a few months! ;) In the meantime, I'll be one with Yahoo!

San Diego Zoo Photos

Luckily I was able to change my schedule a bit last week so I could go to the San Diego Zoo on Friday. I've often heard it called a zoo that does things right, and it really was the best zoo I've been to. Here are a few photos—

snake at the  san diego zoo (click for more)
snake at the San Diego Zoo (click for more)
I'm glad I got to see a bit more of San Diego than the conference hotel.
« Older posts  /  Newer posts »