HTML::Form::parse: No $base_uri provided at /usr/local/share/perl/5.14.2/WWW/Mechanize.pm line 2664

441 views
Skip to first unread message

Nigel Horne

unread,
Oct 11, 2012, 2:57:15 PM10/11/12
to www-mecha...@googlegroups.com
Is WWW::Mechanize thread safe? What are the circumstances under which I
would get the above message when calling submit_form()? I see it when
running under systems such as parallel::simple, but no other times.

-Nigel

Daniel Mantovani

unread,
Oct 13, 2012, 12:51:48 AM10/13/12
to www-mecha...@googlegroups.com, www-mecha...@googlegroups.com
Did you call "get" before ?



Sent from my iPad

Nigel Horne

unread,
Oct 13, 2012, 10:15:28 AM10/13/12
to www-mecha...@googlegroups.com
On 10/13/2012 12:51 AM, Daniel Mantovani wrote:
> Did you call "get" before ?

Either get() or back() depending upon the context.

-Nigel

Daniel Mantovani

unread,
Oct 13, 2012, 11:01:07 AM10/13/12
to www-mecha...@googlegroups.com
Can you show you code ?

--
"A Jedi uses the Force for knowledge and defense, never for attack." - Yoda

Software Engineer
Just Another Perl Hacker
Daniel Mantovani +5511 8538-9897
XOXO

Nigel Horne

unread,
Oct 13, 2012, 4:34:38 PM10/13/12
to www-mecha...@googlegroups.com
On 10/13/2012 11:01 AM, Daniel Mantovani wrote:
> Can you show you code ?
>
#!/usr/bin/perl -w

use Parallel::Simple qw(prun);
use WWW::Mechanize::Cached::GZip;

my $m1 = WWW::Mechanize->new();
my $m2 = WWW::Mechanize->new();
prun([\&doit, $m1], [\&doit, $m2]) || die(Parallel::Simple::errplus());
prun([\&doit, $m1], [\&doit, $m2]) || die(Parallel::Simple::errplus());

sub doit {
my $m = shift; $m->back() || $m->get('http://www.google.com');
my %fields = ('f' => 'hello world');
my $r = $m->submit_form(form_number => 1, fields => \%fields);
unless($r->is_success()) {
die $r->status_line();
}
unless($r->content() =~ /<html/i) {
die "oops";
}
print "done\n";
}

Mike Tonks

unread,
Oct 14, 2012, 6:04:21 AM10/14/12
to www-mecha...@googlegroups.com
Thanks for the example. Your use of Parallel::Simple is interesting,
I haven't looked at this module before.

Your example runs fine for me. I don't see any warnings.

I added:

use strict;
use warnings;

and changed to standard:

use WWW::Mechanize;
#use WWW::Mechanize::Cached::GZip;

but still all works fine.

mike@nova:~$ ./test_mech.pl
done
done
done
done

Is this what you'd expect? What do I have to do to reproduce your issue?

Regards,

mike

Nigel Horne

unread,
Oct 14, 2012, 11:14:14 AM10/14/12
to www-mecha...@googlegroups.com
On 10/14/2012 06:04 AM, Mike Tonks wrote:
> Thanks for the example. Your use of Parallel::Simple is interesting,
> I haven't looked at this module before.
>
> Your example runs fine for me. I don't see any warnings.
>
> I added:
>
> use strict;
> use warnings;
>
> and changed to standard:
>
> use WWW::Mechanize;
> #use WWW::Mechanize::Cached::GZip;
>
> but still all works fine.
>
> mike@nova:~$ ./test_mech.pl
> done
> done
> done
> done
>
> Is this what you'd expect? What do I have to do to reproduce your issue?

You have to run it a number of times for it to happen. How many times
depends on luck, the phase of the moon and if there is an r in the month.

-Nigel
Reply all
Reply to author
Forward
0 new messages