Mature fifth instar swallowtail caterpillars from the genus Papilio, Battus, etc. will purge their undigested food before wandering off the plant to pupate. If you are rearing a swallowtail in the lab or at home, find this purge, you need to move your caterpillar into a lunch sack, gizmo, or another suitable place to form a chrysalis.