I had few questions related to mechanize module during my previous threads. Hats off to all the monks who gave great advise.
What I want to do is have the user enter first name and last name something likeAssuming that use enters first and last name fallowed by a space. Then I was to split it by space get the first name and last name and use the fallowing code that I have to fill the form.print STDOUT "\nEnter name: "; $name = <STDIN>; chomp $name;
Here is the code I have
use Text::Soundex; use WWW::Mechanize; #use MakeRegex; $DEBUG = true; $SOUNDEX = 0; print STDOUT "\nEnter First name: "; $firstname = <STDIN>; chomp $firstname; print STDOUT "\nEnter Last name: "; $lastname = <STDIN>; chomp $lastname; my $url = 'http://www.ancestry.com/'; my $mechObject = WWW::Mechanize->new(); $mechObject->get($url); die "can't get page!" unless $mechObject->success && $mechObject->content =~ /Your First Name/i; die "can't find form!" unless $mechObject->form_number(2); my @values = ($firstname, $lastname, [option => 'M']); die "couldn't fill out form!" unless $mechObject->set_visible(@values) == 3; $mechObject->submit; die "can't submit form!" unless $mechObject->success && $mechObject->content =~ /Your Last Name/i;
Very Sorry, Totally forgot, as a result of above code, it spits out the html code of the first page of ancestry dot com webpage
In reply to Mechanize::How do I get the results back after submit by learnperl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |