Description: My web app (for IIS reasons) uses meta refreshes to redirect the user around. I test these redirects with the code below. I've used a regex as my refresh template is fixed and very, very simple. However, if yours isn't/aren't then you should replace the regex with a call to something like HTML::TokeParser.

Update: fixed silly mistake as hilighted below. Also fixed what was, for my test suite, a logic error. The final get call must be to $expected_url and not $url. If your test quite works differently then use $url instead :).
sub meta_refresh
    my $mech = shift;
    my $expected_url = shift;
    my $url;
    if($mech->content() =~ /<meta http-equiv="refresh" content="0;url=
        $url = $1;

    cmp_ok($expected_url, 'eq', $url, "The meta refresh returns the ex
+pected URL");
    $mech->get( $expected_url );
    ok($mech->success(), "URL loaded successfully");
So call it like this:
   # Code to cause the refresh to appear not shown.
   # Check the refresh and follow
   meta_refresh($mech, '/index.cgi?rm=home');