#!D:\Programme\indigoperl-5.6\bin\perl.exe -w use strict; use WWW::Mechanize; use URI::URL; my $agent = WWW::Mechanize->new(); $agent->env_proxy(); $agent->get('http://www.attachmail.com/'); $agent->form(1) if $agent->forms and scalar @{$agent->forms}; $agent->agent('Mozilla/4.0 (compatible; MSIE 4.01; Windows 98)'); # navigate to the login frame $agent->follow('bott'); { local $^W; $agent->current_form->value('UserId', 'test01'); }; { local $^W; $agent->current_form->value('Passwd', 's'); }; $agent->click('imageField'); # The login page is a redirect die "Unknown page received" unless $agent->content =~ /URL=(.*)'>/; my $redirect = qq{http://www.attachmail.com/cg-bin/$1}; $agent->get($redirect); $agent->form(1) if $agent->forms and scalar @{$agent->forms}; $agent->follow('mailatt'); die "Couldn't retrieve user number" unless $agent->uri=~/userno=(\d+)/; my $userno = $1; $agent->get("http://www.attachmail.com//cg-bin/am_bring_Addbook.cgi?userno=$userno&flg=Disp'); $agent->form(1) if $agent->forms and scalar @{$agent->forms}; $agent->follow('bottomFrame'); $agent->get("http://www.attachmail.com/cg-bin/add_entry.cgi?username=$userno"); $agent->form(1) if $agent->forms and scalar @{$agent->forms}; { local $^W; $agent->current_form->value('nam', 'foo'); }; { local $^W; $agent->current_form->value('email', 'bar@example.com'); }; $agent->submit();