in reply to Re^3: WWW::Mechanize problem
in thread WWW::Mechanize problem

Awesome. Thanks man. Now I got this lol... Input 'zipCode' has maxlength '5' at C:/Perl/lib/WWW/Mechanize.pm line 1247 Here is the code:
use strict; use warnings; print "What zip code? \n"; my $module_name = <STDIN> or die "Must specify module name on command line"; use WWW::Mechanize; my $browser = WWW::Mechanize->new(); $browser->get("http://www.unitrinspecialty.com/us/locator/"); $browser->form_name('zipForm'); $browser->field("zipCode", $module_name); $browser->click();

Replies are listed 'Best First'.
Re^5: WWW::Mechanize problem
by ikegami (Patriarch) on May 29, 2008 at 04:34 UTC
    "12345\n" is 6 characters. chomp
Re^5: WWW::Mechanize problem
by ikegami (Patriarch) on May 29, 2008 at 05:30 UTC

    You mentioned the command line in your error message. Perhaps you want to use @ARGV instead of <STDIN>?

    use strict; use warnings; use WWW::Mechanize qw( ); use File::Basename qw( basename ); sub usage { my $prog = basename($0); print STDERR ("usage: $prog {zipcode}\n"); exit(1); } my ($zip_code) = @ARGV; defined($zip_code) or usage(); my $browser = WWW::Mechanize->new(); $browser->get("http://www.unitrinspecialty.com/us/locator/"); $browser->form_name('zipForm'); $browser->field("zipCode", $module_name); $browser->click();