HTML::Form::ForceValue - who cares what values are legal, anyway?


HTML-Form-ForceValue documentation  | view source Contained in the HTML-Form-ForceValue distribution.

Index


NAME

Top

HTML::Form::ForceValue - who cares what values are legal, anyway?

VERSION

Top

version 0.007

SYNOPSIS

Top

  use Test::WWW::Mechanize tests => 5;
  use HTML::Form::ForceValue;

  my $mech = WWW::Mechanize->new;

  # We're going to test our form.
  $mech->get_ok("http://cgi.example.com/form");

  $mech->set_fields(
    name => 'Crazy Ivan',
    city => 'Vladivostok',
  );

  # What if insane bot tries to claim it's from USSR?
  $mech->form_name("user_info")->find_input("country")->force_value("su");

  $mech->submit;

DEPRECATION NOTICE

Top

As of libwww-perl 5.817, HTML::Form has a strict mode, which restricts form values to the options given. Without strict mode, values may be set to anything you like, making this module unnecessary. It remains on the CPAN for use by those who choose not to upgrade their LWP, but in general this code is now obsolete.

DESCRIPTION

Top

HTML::Form is a very useful module that provides objects to represent HTML forms. They can be filled in, and the filled-in values can be converted into an HTTP::Request for submission to a server.

WWW::Mechanize makes this even easier by providing a very easy to automate user agent that provides HTML::Form objects to represent forms. Test::WWW::Mechanize hangs some testing features on Mech, making it easy to automatically test how web applications behave.

One really important thing to test is how a web application responds to invalid input. Unfortunately, HTML::Form protects you from doing this by throwing an exception when an invalid datum is assigned to an enumerated field. HTML::Form::ForceValue mixes in to HTML::Form classes to provide force_value methods which behave like value, but will automatically add any invalid datum to the list of valid data.

WARNING

Top

This implementation is extremely crude. This feature should really be in HTML::Form (in my humble opinion), and this module should cease to exist once it is. In the meantime, just keep in mind that I spent a lot more time packaging this than I did writing it. Caveat importor!

AUTHOR

Top

Ricardo SIGNES, <rjbs at cpan.org>

BUGS

Top

Please report any bugs or feature requests to bug-form at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=HTML-Form-ForceValue. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

Top

You can find documentation for this module with the perldoc command.

    perldoc HTML::Form::ForceValue

You can also look for information at:

* AnnoCPAN: Annotated CPAN documentation

http://annocpan.org/dist/HTML-Form-ForceValue

* CPAN Ratings

http://cpanratings.perl.org/d/HTML-Form-ForceValue

* RT: CPAN's request tracker

http://rt.cpan.org/NoAuth/Bugs.html?Dist=HTML-Form-ForceValue

* Search CPAN

http://search.cpan.org/dist/HTML-Form-ForceValue

ACKNOWLEDGEMENTS

Top

COPYRIGHT & LICENSE

Top


HTML-Form-ForceValue documentation  | view source Contained in the HTML-Form-ForceValue distribution.