#! perl -w
use strict;
use WWW::Mechanize;
my $url = 'http://crnprdweb/CRN/cgi-bin/cognos.cgi?b_action=xts.run&m=portal/main.xts';
my $mech = WWW::Mechanize->new();
$mech->get( $url );
print $mech->status, "\n";
print $mech->success;
my $content = $mech->content;
$mech->submit_form(
form_number =>1,
fields => {
CAMUsername => 'blahuser',
CAMPassword => 'blahpassword',
}
);
$content = $mech->content;
print $content;
####
H:\script>perl mechtest.pl
401
There is no form named "pform" at mechtest.pl line 12
Can't call method "value" on an undefined value at C:/Perl/site/lib/WWW/Mechaniz
e.pm line 571.
H:\script>perl mechtest.pl
401
There is no form numbered 1 at mechtest.pl line 12
Can't call method "value" on an undefined value at C:/Perl/site/lib/WWW/Mechaniz
e.pm line 571.
####
OK