I’d like to launch an awareness campaign aimed at rude New Yorkers, written in a style they’ll understand, so that one day, maybe,...

From Pinzler:
I took a picture of this poster on the B train. Sorry if the smaller text is hard to read but the...
By Felix Salmon
Stephen Culp has another striking chart today.
This chart should be ingrained in the mind of anybody who cares...
On Facebook a bunch of my friends are encouraging people to sign an online petition by the Working...
A lot of people wonder what I do all day. Here’s a list of all the stuff I’m currently working on (as of October 22, 2011):
So yeah, I’m stretched pretty thin. But as always I’m loving my crazy days which let me regularly work on about 7 or 8 of these things. I rotate through a lot and by the end of a 16 hour day I git ‘r done.


Image via Wikipedia
I stumbled across an odd problem recently. I’m using the Youtube API to grab videos for a new hack I’m working on with Pinzler (to be released shortly).
This is the basic API call and it returns XML.
http://gdata.youtube.com/feeds/api/videos?q=QUERY&max-results=10&v=2
Trouble is, sometimes the result is just ONE record, and other times there are many records. Ok, that’s to be expected, but when navigating this in Perl it throws a weird error - if there is only 1 record, it’s just a simple hash. But if there are many records, it’s an array of hashes and therefore you need to iterate through each array element like this:
foreach $m (@{$data->{entry}}) {
But… if it’s not an array, it just throws a “NOT AN ARRAY” error. WTF?
So I just learned a workaround that does a quick check to see if it’s an array or not using the ref call:
if (ref($data->{‘entry’}) eq “ARRAY”) { print “an array!”; }
else { print “not array!”; }
Anyone have an easier way to deal with this situation? Or maybe I’m doing this totally wrong?
