Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

gav (2710)

gav
  (email not shown publicly)
http://www.estey.com/
AOL IM: flufflegavin (Add Buddy, Send Message)

Hacker in NYC.

Journal of gav (2710)

Thursday September 26, 2002
10:24 PM

cross blogging

[ #8045 ]
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";
<p><i><font size="-1">From: <a href="http://use.perl.org/~gav/journal/">use.perl</a> Posted On: $post->{dateCreated}</font></i></p><p>$content</p>
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.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.