Provided are bioerodible compositions that can be implanted into cavities or mammalian tissue as a liquid or semi-liquid and which solidify upon exposure of the body temperature of the mammal. The implants erode over a prescribed period of time and elute a drug. The implants also form a seal with the skin or mucosa surrounding the cavity to prevent the entry of bacterial pathogens.