#!/usr/bin/perl -w

use strict;
use WWW::Mechanize;

my $uri = shift or die "Must specify a URL or file to check\n";
if ( -e $uri ) {
    require URI::file;
    $uri = URI::file->new_abs( $uri )->as_string;
}

my $mech = WWW::Mechanize->new( cookie_jar => undef );
$mech->get( $uri );
$mech->success or die "Can't fetch $uri\n", $mech->res->status_line, "\n";

$mech->is_html or die "$uri returns type \"", $mech->ct, "\", not \"text/html\"\n";

for my $form ( $mech->forms() ) {
    print $form->dump;
    print "\n";
}

