cross blogging

gav on 2002-09-27T03:24:52

I've got the excellent MovableType as my blog on my website at Estey.com but my life isn't interesting enough for me to maintain two logs. I had an idea about using Net::Blogger to get my post from use.perl and mirroring it. The documentation is a bit confusing but I persevered and here is my first stab:

#!/usr/bin/perl
use strict;
use Net::Blogger;

my $blog = Net::Blogger->new(engine => 'slash', debug => 0);

$blog->Username(2710);
$blog->Password(*****);
$blog->Proxy("http://use.perl.org/journal.pl");
$blog->Uri("http://use.perl.org/Slash/Journal/SOAP");

my ($ok, @posts) = $blog->getRecentPosts();

die "Error! Can't get use.perl recent posts!" unless $ok;

my $post = $blog->getPost($posts[0]->{postid});
my ($title, $content) = split /\n/, $post->{content}, 2;

my $new_post = <<"POST";

From: use.perl Posted On: $post->{dateCreated}

$content

POST my $mt = Net::Blogger->new(engine => "movabletype", debug => 0); $mt->Proxy("http://www.estey.com/cgi-bin/mt-xmlrpc.cgi"); $mt->Username(*****); $mt->Password(*****); $mt->BlogId(2); $mt->metaWeblog->newPost( title => $title, description => $new_post, publish => 1 );
I'm going to tweak things a bit, saving the id's of posts so I can cron it to run hourly.