Not a developer? Go to MovableType.com

Documentation

SYNOPSIS

Creating an MT::Object subclass:

package MT::Foo;
use strict;

use base 'MT::Object';

__PACKAGE__->install_properties({
    columns_defs => {
        'id'  => 'integer not null auto_increment',
        'foo' => 'string(255)',
    },
    indexes => {
        foo => 1,
    },
    primary_key => 'id',
    datasource => 'foo',
});

Using an MT::Object subclass:

use MT;
use MT::Foo;

## Create an MT object to load the system configuration and
## initialize an object driver.
my $mt = MT->new;

## Create an MT::Foo object, fill it with data, and save it;
## the object is saved using the object driver initialized above.
my $foo = MT::Foo->new;
$foo->foo('bar');
$foo->save
    or die $foo->errstr;
Back