Click here to get back home

what is wrong in this code

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
what is wrong in this code Nospam 11-13-2005
Posted by Nospam on November 13, 2005, 10:40 pm
Please log in for more thread options


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




Posted by Sisyphus on November 14, 2005, 10:22 am
Please log in for more thread options



> 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





Similar ThreadsPosted
Math::Pari 'factor' is wrong March 17, 2006, 1:41 pm
Install Picks Wrong Dir for Include Files February 17, 2005, 8:13 pm
ANNOUNCE: Code::Dumper - a ::Dumper for code. Available on CPAN November 21, 2005, 11:03 am
Please help with this code June 10, 2007, 3:40 pm
Image Magick code help November 29, 2004, 12:14 pm
Image Magick code help December 3, 2004, 6:43 pm
Net::Cmd::code doesn't return value of Net::Cmd::dataend January 10, 2005, 9:17 pm
explain code section please... August 28, 2006, 4:41 pm
encode the perl code September 6, 2006, 1:12 am
Using a DBI connection in many places (in the code) August 4, 2008, 4:39 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap