what is wrong in this code

what is wrong in this code

am 13.11.2005 23:40:42 von nospam

this is the code:

#! Perl\bin\perl

use WWW::Mechanize;
my $mech = WWW::Mechanize->new();

$mech->get( $url );


$mech->follow_link( text_regex => qr/viewtopic/i );
$mech->follow_link( url => 'http://www.google.com/index.html' );

$mech->submit_form(
form_number => 3,
fields => {
username => 'guesthere3',
postbody => 'This is a test',
}
);

$mech->submit_form(
form_name => 'post',
fields => { query =>
'http://www.google.co.uk/search?hl=en&safe=off&q=intitle%3A% 22ipod%22+view+f
orum+%22you+can+post+new+topics%22&meta=', },
button => 'submit'
);

This is the error message when I run the code:

Missing base argument at C:/Perl/site/lib/HTTP/Response.pm line 78

Re: what is wrong in this code

am 14.11.2005 00:22:38 von Sisyphus

"Nospam" wrote in message
news:KhPdf.16486$fe6.4468@newsfe2-win.ntli.net...
> this is the code:
>
> #! Perl\bin\perl
>
> use WWW::Mechanize;
> my $mech = WWW::Mechanize->new();
>
> $mech->get( $url );
>
>
> $mech->follow_link( text_regex => qr/viewtopic/i );
> $mech->follow_link( url => 'http://www.google.com/index.html' );
>
> $mech->submit_form(
> form_number => 3,
> fields => {
> username => 'guesthere3',
> postbody => 'This is a test',
> }
> );
>
> $mech->submit_form(
> form_name => 'post',
> fields => { query =>
>
'http://www.google.co.uk/search?hl=en&safe=off&q=intitle%3A% 22ipod%22+view+f
> orum+%22you+can+post+new+topics%22&meta=', },
> button => 'submit'
> );
>
> This is the error message when I run the code:
>
> Missing base argument at C:/Perl/site/lib/HTTP/Response.pm line 78
>
>

Always 'use warnings;' - especially when code is not behaving as you
expected.
If you had used warnings you would have been told that your usage of the
variable '$url' was nonsensical.

Cheers,
Rob