Looking at XML::Twig's source, you can apparently pass subroutine references, regular expressions, or plain strings (which can themselves be used in various ways to express different things). Take a look at the _install_cond subroutine.
Comment on Re: XML::Twig how to find a parent's attribute