
leathan
Novice
Feb 23, 2011, 1:23 PM
Post #1 of 1
(684 views)
|
|
Having problems with WWW::Mechanize
|
Can't Post
|
|
Im not really having problems with WWW::Mechanize persay, when i run my script on websites that i create it runs smoothly, however when i turn my script on facebook i get lots of errors @ the command line. I will post part of my code here (the important part) while (lc($doThis) ne "exit") { print "\nWhat to do?: "; $doThis = <>; chomp ($doThis); if ($doThis eq "find link") {} if ($doThis eq "exit") { exit(0); } if ($doThis eq "find") { do { print "\nWhat to find?: "; $findThis = <>; chomp($findThis); $linkFound = $reader->find_link(text_regex => qr/$findThis/i ); if ($linkFound != undef) { print "Follow link \"" . $linkFound->url() . "\" <Y/N>: "; $follow = <>; chomp($follow); } else { print "No Link found for: " . $findThis } if (lc($follow) eq "y") { $reader->follow_link($linkFound); print "Web Site Text:\n" . $reader->text(); } } while ($findThis ne "exit") } The error i get at the command line is: What to do?: find What to find?: login Follow link "/login.php?http&refsrc=http%3A%2F%2Fwww.facebook.com%2F&no_next_msg&refid=8" <Y/N>: y Odd number of elements in hash assignment at C:/Perl/lib/WWW/Mechanize.pm line 737, <> line 6. Unknown link-finding parameter "WWW::Mechanize::Link=ARRAY(0x3cc202c)" at C:\Users\leathan\Desktop\Scripts\fb.pl line 41 Web Site Text: Reset password | FacebookReset passwordEmail or phone number: What to find?: undef Odd number of elements in hash assignment at C:/Perl/lib/WWW/Mechanize.pm line 737, <> line 7. Use of uninitialized value within @_ in list assignment at C:/Perl/lib/WWW/Mechanize.pm line 737, <> line 7. Unknown link-finding parameter "" at C:\Users\leathan\Desktop\Scripts\fb.pl line 41 Link not found at C:\Users\leathan\Desktop\Scripts\fb.pl line 41 I dont understand any of these errors or what they mean, I do no when i get these errors my script does not function properly and i think it happens just on facebook.com, but if its facebook that is restricting me i dont understand why i get the command line errors, any help would be great EDIT: Also if its any help i get $reader->success(); back as true which should mean it successfully crawled to the new link, but $reader->text() or $reader->content() is still the same.
(This post was edited by leathan on Feb 23, 2011, 1:27 PM)
|