start porting SwapServer from python to perl