Example code from https://metacpan.org/source/HACKER/Net-XMPP-1.02/examples/client.pl