The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Blog::Normalize - Specification for a sane transition between different blogging systems

SYNOPSIS

 use Blog::Normalize::Wordpress;
 use Blog::Normalize::MovableType;
 
 # You've got to create the B::N objects with the database info:
 
 my $wp = Blog::Normalize::Wordpress->new(
        username => $username,
        password => $password,
        hostname => $hostname,
        database => $database,
        prefix => $prefix,
 );
 
 my $mt = Blog::Normalize::MovableType->new(
        username => $username,
        password => $password,
        hostname => $hostname,
        database => $database,
 );
 
 $wp->connect;
 $mt->connect;
 
 # As simple as:
 $mt->import(posts => $wp->posts);

INTRODUCTION

I needed to convert a Wordpress blog to a MovableType one. Since I didn't find anything useful quickly on the web, I developed my own converter. Then I realized some other people could use it and some other ones could actually want it in the oppposite way. Then I thought on people trying to make the same on different blog systems. I've changed from one blog to another several times since I started my own (http://blog.damog.net/) in 2002 and it's been always a pain in the ass make converters. Hereby, I propose the Blog::Normalize module that could import and export all sorts of data from one blogging system to another, as long as they are supported which should be too hard for me (or everybody else, to do).

DESCRIPTION

Objects represent a blog system. They are initialized with the needed information (like the DB info) and ready to get data, import and export. Posts, categories, users, everything should be able to be exported and imported if the common spec is followed.

SPECIFICATION

POSTS

The posts should be an array reference containing, as each of the elements, a hash reference containing each of the posts. As the time of writing, the values id, title, date, text, name should be passed.

This illustrates the idea:

 my $posts = [
        {
                id => 2,
                title => 'This post is awesome!',
                text => 'This is my second post on my blog. Welcome to it!',
                date => '2008-02-23 21:02:52',
                name => 'this-post-is-awesome',
        },
        {
                id => 1,
                title => 'Hit by a taxi',
                text => 'Today, after leaving the office, I was hit by a taxi
                        in New York City. I'm just fine but it was a shocking moment.',
                date => '2008-01-06 18:51:00',
                name => 'hit-by-a-taxi',
        },
 ];

id

The id is usually just the idea for each of the posts, you may use the permalink here too.

title

The title of the post entry.

text

The extended entry of the post.

date

A YYYY-MM-DD mm:hh:ss formated time.

name

A short string for identifying the post.

BUGS

Nearly everything is broken :) The only thing that barely works right now is the import from Wordpress to MovableType, but more work is being done. I strongly support on the c<Release Early, Release Often> motto.

TODO

  • A LOT. ;)

  • Start the implementation of TextMotion.

  • Start the implementation of Blogger which won't use DBI but web scrapping.

  • Allow a DBI object on the constructor of the networks so we don't have to.

  • Specification for categories, user and different blogs within a same blogging system.

DISCLAIMER

This may be taken as an specification for blogging systems, but I don't want the application to be too ambitious, so if you like the idea, it's great! Otherwise, if you think I'm reinventing the wheel or doing something that I shouldn't be doing, beat it. As Andy Lester commented on a Perlbuzz column, let new projects and ideas flow!

I do think it's nice to allow developers to make great things quickly, effectively and leaving all hard tasks to the backend through an easy spec.

AUTHOR

David Moreno Garza, <damogar@gmail.com<gt> - http://damog.net/

THANKS

To Raquel (http://www.maggit.com.mx/), who makes me happy every single day of my life.

COPYRIGHT AND LICENSE

Copyright (C) 2008 by David Moreno Garza

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.

The Do What The Fuck You Want To public license also applies. It's really up to you.