W::M is built on top of a number of modules. The form handling is done in HTML::Form. A call to forms() on the mech object will return a list of HTML::Form objects for all of the forms. From the HTML::Form object, we can check if a field exists with find_input(). Something akin to this:
foreach my $form ($mech->forms()) {
if ($form->find_input("fieldname") {
do_stuff();
}
}