Net::Blogger::Engine::Userland - base class for UserLand Blogger API engines


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

Index


Code Index:

NAME

Top

Net::Blogger::Engine::Userland - base class for UserLand Blogger API engines

SYNOPSIS

Top

 It's very dark in here because this is a black box.

DESCRIPTION

Top

This package inherits Net::Blogger::Engine::Base and implements shared methods for the UserLand Manila and RadioUserland XML-RPC servers.

This package should not be called directly. It is a base class used by Net::Blogger::Engine::Manila and Net::Blogger::Engine::Radio

OBJECT METHODS

Top

$pkg->init(\%args)

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

$pkg->Proxy($uri)

Get/set the URI of the Manila->Blogger proxy.

If no proxy is explicitly defined then the method determines the hostname for the Manila server using the current blogid.

 "Just to clarify, the URI is /RPC2, even if your blogid (homepage url) is 
  a sub-site url, like http://www.myserver.com/mysite/. It's never something 
  like /mysite/RPC2." 

    --Jake Savin (Userland)

$pkg->AppKey()

Returns true. Manila does not require a Blogger API key, but specifies something (anything) all the same.

$pkg->BlogId()

Get/Set the current blog id.

Ensures that the blogid contains a trailing slash, without which the Frontier engine freaks out.

$pkg->MaxPostLength()

By default, returns undef. In other words, there is no max post length for Manila.

 "As far as I know there is no max length for a post, certainly nothing you have 
  to enforce on your end." 

   --Dave Winer (Userland)

metaWeblog API 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

http://frontier.userland.com/emulatingBloggerInManila

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::Userland;
use strict;

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

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

use Exporter;
use URI;

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

    my $child = caller();
    
    if (! $child =~ /^(Net::Blogger::Engine::(Manila|Radio))$/) {
	return 0;
    }

    if (exists $args->{'proxy'}) {
	$self->Proxy($args->{'proxy'});
	delete $args->{'proxy'};
    }

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

sub Proxy {
    my $self  = shift;
    my $proxy = shift;

    if ($proxy) {
	$self->{"_proxy"} = $proxy;
	return $self->{"_proxy"};
    }

    if ($self->{"_proxy"}) {
	return $self->{"_proxy"};
    }
    
    if (my $blog = $self->BlogId()) {
	my $uri = URI->new($blog);
	$self->{"_proxy"} = $uri->scheme()."://".$uri->host()."/RPC2";

	$self->{"_client"} = undef;
	return $self->{"_proxy"};
    }

    $self->LastError("Unable to determine proxy explicitly or by parsing blogid.");
    return undef;
}

sub AppKey {
    my $self = shift;
    return 1;
}

sub BlogId {
  my $self = shift;
  my $id   = shift;

  if ($id) {
    unless ($id =~ /^(.*)\/$/) { $id .= "/"; }
    $self->{'_blogid'} = $id;
  }

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

sub MaxPostLength {
    my $self = shift;
    return undef;
}


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;

}