Saving an object

To save an object using the object driver, call the save method:

$foo->save();

On success, save will return some true value; on failure, it will return undef, and you can retrieve the error message by calling the errstr method on the object:

$foo->save
    or die "Saving foo failed: ", $foo->errstr;

If you are saving objects in a loop, take a look at the "Note on object locking".

This page was last updated on 2008-10-01, 17:07.

Leave a note

Have a question? Please use the MT Forums. Notes submitted on documentation should pertain to tips & hints regarding documentation. Your note may be removed once its contents have been integrated into the body of the page.