in reply to Re^3: RPC::XML error
in thread RPC::XML error

I thought you wanted to use RPC? If that's the only place where the sub is called, then you're not using RPC.