use WWW::Mechanize::Tor; my $mech = WWW::Mechanize::Tor->new( tor_control_port => 9051, # empty port on default range(49152 .. 65535) tor_port => 9050, # empty port on default range(49152 .. 65535) tor_ip => '127.0.0.1', # localhost on default tor_config => 'path/to/torrc', # tor default config path); if ($mech->rotate_ip) { say 'got another ip';}else { say 'Try again?';}