An algorithm for coloring some perfect graphs