Install Devel::Trace (libdevel-trace-perl in Ubuntu) and launch your program using "perl -d:Trace ./xx.pl" like syntax. This gives you tracing similar to "set -x" on shell scripts.
Until recently rtorrent didn't support adding new trackers to torrent except by editing actual .torrent. Either manually, with some tool or via online service such as http://www.torrenteditor.com. Recently support to add trackers on the fly to active torrent was added, but documentation seems to be little thin.