Since WWW::Mechanize ISA LWP::UserAgent, you can use the methods as described in lwpcook, to achieve that goal.
In reply to Re: Mechanize module by bart in thread Mechanize module by sanPerl