Bergman functions on weakly uniformly perfect domains