NAME

MT - Movable Type


SYNOPSIS

    use MT;
    my $mt = MT->new;
    $mt->rebuild(BlogID => 1)
        or die $mt->errstr;


DESCRIPTION

The MT class is the main high-level rebuilding/pinging interface in the Movable Type library. It handles all rebuilding operations. It does not handle any of the application functionality--for that, look to MT::App and MT::App::CMS, both of which subclass MT to handle application requests.


USAGE

MT has the following interface. On failure, all methods return undef and set the errstr for the object or class (depending on whether the method is an object or class method, respectively); look below at the section ERROR HANDLING for more information.

MT->new( %args )

Constructs a new MT instance and returns that object. Returns undef on failure.

new will also read your mt.cfg file (provided that it can find it--if you find that it can't, take a look at the Config directive, below). It will also initialize the chosen object driver; the default is the DBM object driver.

%args can contain:

$mt->rebuild( %args )

Rebuilds your entire blog, indexes and archives; or some subset of your blog, as specified in the arguments.

%args can contain:

$mt->rebuild_entry( %args )

Rebuilds a particular entry in your blog (and its dependencies, if specified).

%args can contain:

$mt->rebuild_indexes( %args )

Rebuilds all of the index templates in your blog, or just one, if you use the Template argument (below). Only rebuilds templates that are set to be rebuilt automatically, unless you use the Force (below).

%args can contain:

$mt->ping( %args )

Sends all configured XML-RPC pings as a way of notifying other community sites that your blog has been updated.

%args can contain:

$mt->set_language($tag)

Loads the localization plugin for the language specified by $tag, which should be a valid and supported language tag--see supported_languages to obtain a list of supported languages.

The language is set on a global level, and affects error messages and all text in the administration system.

This method can be called as either a class method or an object method; in other words,

    MT->set_language($tag)

will also work. However, the setting will still be global--it will not be specified to the $mt object.

The default setting--set when MT::new is called--is U.S. English. If a DefaultLanguage is set in mt.cfg, the default is then set to that language.

$mt->translate($str)

Translates $str into the currently-set language (set by set_language), and returns the translated string.

$mt->current_language

Returns the language tag for the currently-set language.

MT->supported_languages

Returns a reference to an associative array mapping language tags to their proper names. For example:

    use MT;
    my $langs = MT->supported_languages;
    print map { $_ . " => " . $langs->{$_} . "\n" } keys %$langs;

MT->VERSION

Returns the version of MT (including any beta/alpha designations).

MT->version_number

Returns the numeric version of MT (without any beta/alpha designations). For example, if VERSION returned 2.5b1, version_number would return 2.5.


ERROR HANDLING

On an error, all of the above methods return undef, and the error message can be obtained by calling the method errstr on the class or the object (depending on whether the method called was a class method or an instance method).

For example, called on a class name:

    my $mt = MT->new or die MT->errstr;

Or, called on an object:

    $mt->rebuild(BlogID => $blog_id)
        or die $mt->errstr;


LICENSE

Please see the file LICENSE in the Movable Type distribution.


AUTHOR & COPYRIGHT

Except where otherwise noted, MT is Copyright 2001, 2002 Benjamin Trott, ben@movabletype.org, and Mena Trott, mena@movabletype.org. All rights reserved.