Perl is a Shinto Shrine
I love this little talk Clay Shirky gave at Supernova 2007:
“The Imbe Priests would totally get Linux!” via reddit.
Filed under: ClayShirky, perl, shinto, video · 0 Comments
I love this little talk Clay Shirky gave at Supernova 2007:
“The Imbe Priests would totally get Linux!” via reddit.
Filed under: ClayShirky, perl, shinto, video · 0 Comments
Here is a lightning talk by Partick Michaud at YAPC::Europe 2008 in Copenhagen, demonstrating the Parrot Compiler Toolkit. Live demo: a LOLCODE compiler. wut?
It would be really nice if we can take all these languages, pass them through Parrot, and translate them to other languages. I decided that wasn’t good enough. Let’s just translate them to LOLCODE.
video:
Filed under: code code, lolcode, parrot, perl, wtf??? · 0 Comments
I’ve been translating all the new perl and php scripts I write into Python and Ruby in order to learn more about those two languages. I checked some more example scripts into SourceForge, which might be useful for others who know one of these languages and want to learn a new one.
These scripts are available in perl, php, python, and ruby:
I’m starting to like Ruby more every day. It would be nice if Ruby and Python had a XML::Simple equivalent in their standard distributions.
Filed under: code code, example scripts, perl, php, python, ruby · 0 Comments
I remember when I fell in love with Perl. It was the summer of 1995, and peliom and I had just met, and were working at the Lab. Postscript hacking using MacPerl on OS 8. It was beautiful.
That was more than ten years ago, and even though I’ve remained a Perl hacker the whole time, I see massive amounts of development happening on Python and Ruby, and the Perl community seems to be slowing down (what’s up with Perl 6 anyway?), so, despite the lack of block-level scope, I think it might finally be time to move on.
I don’t know enough about either Python or Ruby to figure out which to learn, so I’ll learn them both, and deal with choosing one later. Along the way I’ll post some example scripts. Anyone else making the jump from Perl or PHP to something modern might find these useful. Here is the first example: printing out a directory listing using readdir and glob in your favorite scripting language:
Filed under: code code, example scripts, perl, php, python, ruby · 3 Comments
Update: Here is a Cocoa version that is easier to use!
May did a good job selling us on Twitter, so now you can see my twittr status in the sidebar.. I wished that changing my Twitter status was as easy as changing my iChat status, so I hacked up this bit of perl that will update it when your iChat status changes. It runs every five minutes via launchd, and uses the newly-announced Twitter API.
[perl]#!/usr/bin/perl
use strict;
use warnings;
use URI::Escape;
my $user = ‘user@example.com’;
my $pass = ‘pin’;
my $isAvailable = `osascript -e ‘tell application “iChat” to status’`;
chomp $isAvailable;
exit if (‘available’ ne $isAvailable);
my $status = `osascript -e ‘tell application “iChat” to status message’`;
chomp $status;
if (” eq $status) {
$status = ‘lazy’;
}
my $savedStatusFile = ‘savedStatus.txt’;
my $savedStatus = ”;
if (-e $savedStatusFile) {
$savedStatus = `cat $savedStatusFile`;
}
if ($status ne $savedStatus) {
#status changed, update twitter
my $encStatus = ‘status=’ . uri_escape($status, “^A-Za-z0-9″);
`curl -s -d ‘$encStatus’ -u $user:$pass http://twitter.com/statuses/update.xml`;
open (FILE, “>$savedStatusFile”) or die “can’t open $savedStatusFile for writing”;
print FILE $status;
close FILE;
}
[/perl]
You can get launchd to run the script every five minutes by creating a file called ~/Library/LaunchAgents/net.tikirobot.status.plist that looks like this:
[xml]
And then load the job using:
launchctl load ~/Library/LaunchAgents/net.tikirobot.status.plist
Update: The script now uses URI::URL and POST. Fixed a typo.
Update2: Now uses URI::Escape
Filed under: code code, perl · 17 Comments