Net::Blogger::Engine::Movabletype - Movabletype Blogger API engine


Net-Blogger documentation Contained in the Net-Blogger distribution.

Index


Code Index:

NAME

Top

Net::Blogger::Engine::Movabletype - Movabletype Blogger API engine

SYNOPSIS

Top

 my $mt = Net::Blogger->new(engine=>"movabletype");

 $mt->Proxy("http://mtserver.com/mt-xmlrpc.cgi");
 $mt->Username("foo");
 $mt->Password("bar");

 my $postid_1 = $mt->newPost(postbody=>\"hello world") 
    || croak $mt->LastError();

 my $postid_2 = $mt->metaWeblog()->newPost(
	   		                   title=>"hello",
			                   description=>"world",
			                   publish=>1,
			                   );

DESCRIPTION

Top

This package inherits Net::Blogger::Engine::Base and implements methods specific to a MovableType XML-RPC server.

Blogger API OBJECT METHODS

Top

$pkg->getRecentPosts(\%args)

Releases prior to Net::Blogger 0.85 accepted a list of arguments rather than a reference. Version 0.85+ are backwards compatible.

Movable Type (mt) API OBJECT METHODS

Top

$pkg->mt()

Returns an object. Woot!

metaWeblog API OBJECT METHODS

Top

$pkg->metaWeblog()

Returns an object. Woot!

VERSION

Top

1.0

DATE

Top

$Date: 2005/03/26 19:29:08 $

AUTHOR

Top

Aaron Straup Cope

SEE ALSO

Top

Net::Blogger::Engine::Base

Net::Blogger::Engine::Movabletype::mt

Net::Blogger::Engine::Userland::metaWeblog

http://aaronland.net/weblog/archive/3719

LICENSE

Top

Copyright (c) 2001-2005 Aaron Straup Cope.

This is free software, you may use it and distribute it under the same terms as Perl itself.


Net-Blogger documentation Contained in the Net-Blogger distribution.
{

package Net::Blogger::Engine::Movabletype;
use strict;

$Net::Blogger::Engine::Movabletype::VERSION   = '1.0';
@Net::Blogger::Engine::Movabletype::ISA       = qw ( Exporter Net::Blogger::Engine::Base );
@Net::Blogger::Engine::Movabletype::EXPORT    = qw ();
@Net::Blogger::Engine::Movabletype::EXPORT_OK = qw ();

use Exporter;
use Net::Blogger::Engine::Base;

sub getRecentPosts {
    my $self = shift;
    my $args = (ref($_[0]) eq "HASH") ? shift : {@_};

    my $num   = (defined $args->{'numposts'}) ? $args->{'numposts'} : 1;
    my $posts = [];

    unless ($num =~ /^(-)*(\d+)$/) {
	$self->LastError("Argument $args->{'numposts'} isn't numeric.");
        return 0;
    }

    if ($num > -1) { $num = 0; }

    return $self->SUPER::getRecentPosts($args);
}

sub mt {
  my $self = shift;

  if (! $self->{'__mt'}) {

    require Net::Blogger::Engine::Movabletype::mt;
    my $mt = Net::Blogger::Engine::Movabletype::mt->new(debug=>$self->{debug});

    map { $mt->$_($self->$_()); } qw (BlogId Proxy Username Password);
    $self->{'__mt'} = $mt;
  }

  return $self->{'__mt'};
}

sub metaWeblog {
  my $self = shift;

  if (! $self->{__meta}) {

    require Net::Blogger::Engine::Userland::metaWeblog;
    my $meta = Net::Blogger::Engine::Userland::metaWeblog->new(debug=>$self->{debug});

    map { $meta->$_($self->$_()); } qw (BlogId Proxy Username Password);
    $self->{__meta} = $meta;
  }

  return $self->{__meta};
}

return 1;

}