Not a developer? Go to



Creating an MT::Object subclass:

package MT::Foo;
use strict;

use base 'MT::Object';

    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;
    or die $foo->errstr;

Leave a Comment