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

Hi,

I've been trying all day to figure out how to use the WWW::Mechanize::FormFiller module I got fom CPAN and being a perl novice I am having an extremely difficult time with it. Does anyone know of a place that has a tutorial of how to use it? I'm seriously about to toss my monitor out the window!!

edited: Wed Apr 16 02:17:41 2003 by jeffa - s/<br>/<p>/g

  • Comment on WWW:Mechanize::FormFiller documentation

Replies are listed 'Best First'.
Re: WWW:Mechanize::FormFiller documentation
by tachyon (Chancellor) on Apr 16, 2003 at 03:23 UTC

    WWW::Mechanize::FormFiller is a sub class of WWW::Mechanize What this means is that it inherits many of its methods from WWW::Mechanize. To save unnecessary documentation duplication the methods supplied by the WWW::Mechanize base class are only documented in WWW::Mechanize although they are all available when you use WWW::Mechanize::FormFiller. The docs for FormFiller only cover the additional methods that it adds to the base class so read the docs for the base class module and all should become clear. There is even sample code. You can just use WWW::Mechanize by itself as the FormFiller subclass just supplies convenience methods on top of the base class.

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

      I'm sory for the confusion (not alleviated through the misprocessed POD / Examples) that this module causes, but it's not a subclass of WWW::Mechanize - it merely provides convenient ways of setting defaults/retrieving values when filling out HTML forms. It's mostly used by WWW::Mechanize::Shell and the scripts that WWW::Mechanize::Shell creates. What the original poster wanted seems to be to generate HTML, not to consume HTML, so WWW::Mechanize::FormFiller is on the wrong end :-)

      perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web
Re: WWW:Mechanize::FormFiller documentation
by The Mad Hatter (Priest) on Apr 16, 2003 at 02:35 UTC
Re: WWW:Mechanize::FormFiller documentation
by jasonk (Parson) on Apr 16, 2003 at 02:59 UTC

    What are you trying to do, and what happened when you tried it? If you are just trying to fill out a web-based form, WWW::Mechanize can do that without the FormFiller module. If you really are trying to use callbacks to fill the form, then give us a hint what you are having trouble with.


    We're not surrounded, we're in a target-rich environment!
      Ok, here's what I need to do:
      I am writing these perl scripts for a database I'm developing
      which has a series of forms associated with
      entering new data into the database. When the user submits
      a query to the database he/she will have the option
      to edit any of the returned records. If the user chooses to
      edit a record I need the script to present the user with the same
      form he/she used to enter the data except that all of the
      fields will be filled in with the corresponding values from the database.
      Entering and retrieving the information from the database is not a problem,
      but I just need some way to populate the forms and present them back to the user.
      What is the easiest module to use in order to do this?
      Thanks again to everyone who has helped me thus far.
        You'll have to generate the HTML for the page and set the value of each form field using the value attribute for the tag. Escaping the data would also be a good idea, and maybe some kind of check to make sure the user didn't enter anything they shouldn't have.

        I usually use HTML::Template to create my, um, HTML templates. The escapeHTML method in CGI should be good enough for escaping data. There might be some module that can do all of this for you, but I don't know about it off hand...