Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Greetings monks. Using this script:

http://web.archive.org/web/20070518134147/http://www.glitchnyc.com/?page_id=117

But with the names of the form and inputs updated to the current MySpace site produces these errors:

Use of uninitialized value in pattern match (m//) at addfriend.pl line + 136, <CSV> line 1. Use of uninitialized value in pattern match (m//) at addfriend.pl line + 136, <CSV> line 1. Can't locate object method "form" via package "WWW::Mechanize" at addf +riend.pl line 184, <CSV> line 1. Adding friend 95473264...

Can you explain how I can rid myself of them so the script works again?

Replies are listed 'Best First'.
Re: Can't find form method in WWW::Mechanize
by almut (Canon) on Sep 29, 2007 at 21:58 UTC

    AFAIK, the form() method has been deprecated for a while, and has in the meantime been replaced with form_name() and form_number(). So, you probably want to modify that line 184 to read:

    $agent->form_name("addFriend");

    The "uninitialized value in pattern match" seems to happen here

    $_ = $tag->get_attr("href"); if ( /friend[iI][dD]/ ){ ...

    so, apparently, the href attribute is empty, or not found... I'm afraid I can't help you with that any further, though...

      After changing form() to form_name() it works now, so I won't worry about the other errors. Cheers!