Not a developer? Go to


Determining if an object exists in the datastore

To check an object for existence in the datastore, use the exists method:


if ($foo->exists) {
    print "Foo $foo already exists!";

To test for the existence of an unloaded object, use the ‘exist’ method:

Class->exist( \%terms )

if (MT::Foo->exist( { foo => 'bar' })) {
    print "Already exists!";

This is typically faster than issuing a count call.