in reply to BioPerl: Best Gene Ontology API
You should maybe have a look at the Bioconductor R packages Category and GOstats as well. There are many annotation databases in Bioconductor and they are well maintained. So you can use basically the same code for enrichment tests of other annotation databases, for example KEGG, PFAM, Chromosome Bands etc. And it's easy to map ids (affy, illumina,..) to Entrez for example.