return $obj->error("Got an error") unless $foo; ## OR return $class->error("Got an error") unless $foo;