Friendfeed:

From Facebook
Alex has fairy lights.

From Google Reader
Human rights court rules UK DNA grab illegal

From Google Reader
Net speed rules come into force

From YouTube
Guess who's coming to dinner...

From YouTube
Chicken Head Tracking - Pennywhistle Productions

From YouTube
Get in the back of the van - Swede Mason

From YouTube
MHS Milk Run 2007

From YouTube
Windex Commercials - April Screening

From YouTube
Rachmaninov had big Hands

From YouTube
(Translated) Angry German Kid - Correct Translation

Recent Posts

« June 2008 | Main | November 2008 »

July 13, 2008

Ping.fm in Perl

Using the fabulous ping.fm? Want to use your own Custom URL? Want to use Perl? Use this!

The attached script takes only status updates from ping.fm and writes it out to a file. In my case, this file is then "included" by apache dynamically on the front page of my site.

Bit rough and ready, but hey, it only took 60 seconds :)

   1: #!/usr/bin/perl
   2:  
   3: use strict;
   4: use warnings;
   5:  
   6: use CGI qw/:standard/;
   7: use CGI::Carp 'fatalsToBrowser';
   8:  
   9: my $file = '/path/to/my/file.include';
  10:  
  11: open my $FH, '>', $file or die "Unable to open $file\n";
  12:  
  13: if ( param() ) {
  14:  
  15:        print header;
  16:        my $method = param('method');
  17:        my $title = param('title');
  18:        my $message = param('message');
  19:        
  20:        print $FH "$message";
  21:        
  22: }
  23:  
  24: else {
  25:  
  26:     print header;
  27:     #Do nothing
  28:     
  29: }
  30:  
  31: close $FH;