in reply to Some Weird behavior with BerkeleyDB and WWW::Mechanize

It seems very unlikely that the sole useage of WWW::Mechanize and the method call changes your data.

I think it's more likely that there is another part of your code that interferes with the code that you showed us.

If you want us to test that you'd have to provide a sample script that we can execute and that demonstrates your problem.

  • Comment on Re: Some Weird behavior with BerkeleyDB and WWW::Mechanize

Replies are listed 'Best First'.
Re^2: Some Weird behavior with BerkeleyDB and WWW::Mechanize
by downer (Monk) on Dec 05, 2007 at 20:39 UTC
    there really isnt much else to my code:
    #!/usr/bin/perl -w use strict; use BerkeleyDB; use WWW::Mechanize; my $mech = WWW::Mechanize->new(); my %pageHash; tie %pageHash, "BerkeleyDB::Btree", -Filename => 'pageContents', -Flags => DB_CREATE, or die "Cannot open file pageContents: $! $BerkeleyDB::Error\n +" ; my %hash; tie %hash, "BerkeleyDB::Btree", -Filename => 'videoDB', -Flags => DB_CREATE, or die "Cannot open file videoDB: $! $BerkeleyDB::Error\n" ; foreach my $x (keys %hash) { print "getting $x:"; my $data = $hash{$x}; my @parts = split(/\t/, $data); my $url = $parts[0]; $mech->get( "$url" ); if($mech->success()) { #$pageHash{$x} = $mech->content( format => 'text' ); print " done\n"; } else { print " failed\n"; } sleep(15); }
      I tested your code (I added two URLs to the hash) and I can't reproduce your problem. Neither key nor value get modified in any strange ways.

      Maybe try to move your pageContents files and start with an empty, clean one and check if the error still occurs.

        i get the following error :  Use of uninitialized value in pattern match (m//) at /usr/lib/perl5/vendor_perl/5.8.6/HTTP/Cookies.pm line 45. each time through the loop. I think this is happening somewhere within the WWW::Mechanize->get(), maybe this regex is modifying the regex somehow?